cusstom token (#1588)
* rest with spark java * 4 * Update Application.java * indentation changes * spring @requestmapping shortcuts * removing spring requestmapping and pushing spring-mvc-java * Joining/Splitting Strings with Java and Stream API * adding more join/split functionality * changing package name * testcase change * adding webutils * adding testcase for WebUtils and ServletRequestUtils * adding testcase * spring-security-stormpath * adding ratpack module * adding pom.xml * adding following modules with updated testcase : DB, Filter, Json * adding spring-boot custom banner tutorial * changing banner format in plain text * Delete banner.txt~ * Delete b.txt~ * CORS in JAX-RS * ratpack with google guice * adding factory instance example * quick-guide-to-the-java-stringtokenizer * Update Application.java * Delete MovieCrudService.java~ * token customization * Update Application.java * adding csv test * adding csv test * Update Application.java * adding collection module
This commit is contained in:
@@ -11,20 +11,37 @@ import static org.junit.Assert.assertEquals;
|
||||
public class ApplicationTest {
|
||||
|
||||
Application application = new Application();
|
||||
List<String> expectedTokens = new ArrayList<String>();
|
||||
|
||||
List<String> expectedTokensForString = new ArrayList<String>();
|
||||
List<String> expectedTokensForFile = new ArrayList<String>();
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
expectedTokens.add( "Welcome" );
|
||||
expectedTokens.add( "to" );
|
||||
expectedTokens.add( "baeldung.com" );
|
||||
expectedTokensForString.add("Welcome");
|
||||
expectedTokensForString.add("to");
|
||||
expectedTokensForString.add("baeldung.com");
|
||||
|
||||
expectedTokensForFile.add("1");
|
||||
expectedTokensForFile.add("IND");
|
||||
expectedTokensForFile.add("India");
|
||||
expectedTokensForFile.add("2");
|
||||
expectedTokensForFile.add("MY");
|
||||
expectedTokensForFile.add("Malaysia");
|
||||
expectedTokensForFile.add("3");
|
||||
expectedTokensForFile.add("AU");
|
||||
expectedTokensForFile.add("Australia");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenString_thenGetListOfString() {
|
||||
String str = "Welcome,to,baeldung.com";
|
||||
List<String> actualTokens = application.getTokens(str);
|
||||
assertEquals(expectedTokens, actualTokens);
|
||||
assertEquals(expectedTokensForString, actualTokens);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenFile_thenGetListOfString() {
|
||||
List<String> actualTokens = application.getTokensFromFile("data.csv", "|");
|
||||
assertEquals(expectedTokensForFile, actualTokens);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user