package daruma.util.test;

import org.junit.Test;
import junit.framework.TestCase;

import daruma.util.StringSplitter;


public class StringSplitterTest extends TestCase
{
	@Test
	public	void	testGetLastElement()
	{
		/*
		assertEquals( "ghi" ,
			      StringSplitter.getLastElement
			      ( "abc/def/ghi" , "/" ) );
		*/
		assertEquals( "ghi" ,
			      StringSplitter.getLastNonEmptyElement
			      ( "abc/def/ghi" , "/" ) );


		/*
		assertEquals( "" ,
			      StringSplitter.getLastElement
			      ( "abc/def/" , "/" ) );
		*/

		assertEquals( "def" ,
			      StringSplitter.getLastNonEmptyElement
			      ( "abc/def/" , "/" ) );


		assertEquals( null ,
			      StringSplitter.getLastNonEmptyElement
			      ( "" , "/" ) );
		assertEquals( null ,
			      StringSplitter.getLastNonEmptyElement
			      ( "" , "/" ) );
		assertEquals( null ,
			      StringSplitter.getLastNonEmptyElement
			      ( "/" , "/" ) );


		/*
		assertEquals( "d" ,
			      StringSplitter.getLastElement
			      ( "abcd" , "bc" ) );
		*/

		assertEquals( "d" ,
			      StringSplitter.getLastNonEmptyElement
			      ( "abcd" , "bc" ) );
	}
}
