### Question:
EndTrimmingTokenizer implements StringTokenizer { @Override public List<String> tokenize(String input) { List<String> result = myTokenizer.tokenize(input); while (!result.isEmpty() && myPredicate.test(result.get(result.size() - 1))) { result.remove(result.size() - 1); } return result; } EndTrimmingTokenizer(Predicate<String> predicate, StringTokenizer tokenizer); @Override List<String> tokenize(String input);  }### Answer:
@Test public void test() { List<String> result = new ArrayList<>(Arrays.asList("", "one", "two", "", "three", "", "")); String input = "input"; StringTokenizer tokenizer = EasyMock.createMock(StringTokenizer.class); EasyMock.expect(tokenizer.tokenize(input)).andReturn(result); EasyMock.replay(tokenizer); List<String> actual = new EndTrimmingTokenizer(new BlankPredicate(), tokenizer).tokenize(input); Assert.assertEquals(result.subList(0, 5), actual); }