@Test public void testFindFirstTextToken(){ CliToken textCliToken = new CliTokenImpl(true,"textCliToken"); CliToken nonTextCliToken = new CliTokenImpl(false,"nonTextCliToken"); Assert.assertEquals(null, TokenUtils.findFirstTextToken(null)); Assert.assertEquals(null, TokenUtils.findFirstTextToken(new ArrayList<CliToken>())); Assert.assertEquals(null, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{null}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{null, textCliToken}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{null, nonTextCliToken, textCliToken}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{nonTextCliToken, null, textCliToken}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{textCliToken}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{nonTextCliToken, textCliToken}))); Assert.assertEquals(textCliToken, TokenUtils.findFirstTextToken(newCliTokenList(new CliToken[]{textCliToken, nonTextCliToken}))); }
public static CliToken findFirstTextToken(List<CliToken> tokens) { if (tokens == null || tokens.isEmpty()) { return null; } CliToken first = null; for (CliToken token : tokens) { if (token != null && token.isText()) { first = token; break; } } return first; }
TokenUtils { public static CliToken findFirstTextToken(List<CliToken> tokens) { if (tokens == null || tokens.isEmpty()) { return null; } CliToken first = null; for (CliToken token : tokens) { if (token != null && token.isText()) { first = token; break; } } return first; } }
TokenUtils { public static CliToken findFirstTextToken(List<CliToken> tokens) { if (tokens == null || tokens.isEmpty()) { return null; } CliToken first = null; for (CliToken token : tokens) { if (token != null && token.isText()) { first = token; break; } } return first; }  }
TokenUtils { public static CliToken findFirstTextToken(List<CliToken> tokens) { if (tokens == null || tokens.isEmpty()) { return null; } CliToken first = null; for (CliToken token : tokens) { if (token != null && token.isText()) { first = token; break; } } return first; }  static CliToken findFirstTextToken(List<CliToken> tokens); static CliToken findLastTextToken(List<CliToken> tokens); static String findSecondTokenText(List<CliToken> tokens); static CliToken getLast(List<CliToken> tokens); static String retrievePreviousArg(List<CliToken> tokens, String lastToken); }
TokenUtils { public static CliToken findFirstTextToken(List<CliToken> tokens) { if (tokens == null || tokens.isEmpty()) { return null; } CliToken first = null; for (CliToken token : tokens) { if (token != null && token.isText()) { first = token; break; } } return first; }  static CliToken findFirstTextToken(List<CliToken> tokens); static CliToken findLastTextToken(List<CliToken> tokens); static String findSecondTokenText(List<CliToken> tokens); static CliToken getLast(List<CliToken> tokens); static String retrievePreviousArg(List<CliToken> tokens, String lastToken);  }