results = findStartsWith(startsWithCriteria);
@Test public void notFound() { ClassType stringType = new ClassType(String.class.getName()); ClassType objectType = new ClassType(Object.class.getName()); ClassType thisType = new ClassType(FqnIndexer.class.getName()); indexer.index(stringType); indexer.index(thisType); indexer.index(new ClassType("a")); indexer.index(new ClassType("java.nolang")); indexer.index(objectType); // middle Collection<ClassType> results = indexer.findStartsWith("aa"); assertThat(results, is(empty())); results = indexer.findStartsWith("java.lang.something"); assertThat(results, is(empty())); results = indexer.findStartsWith("ww"); assertThat(results, is(empty())); } }
@Test public void found() { ClassType stringType = new ClassType(String.class.getName()); ClassType objectType = new ClassType(Object.class.getName()); ClassType thisType = new ClassType(FqnIndexer.class.getName()); indexer.index(stringType); indexer.index(thisType); indexer.index(new ClassType("a")); indexer.index(new ClassType("java.nolang")); indexer.index(objectType); // middle Collection<ClassType> results = indexer.findStartsWith("java.lang"); assertThat(results, hasSize(2)); for (ClassType classType : results) { assertThat(classType.getFQN().startsWith("java.lang"), is(true)); } // end results = indexer.findStartsWith("java.nolang"); assertThat(results, hasSize(1)); for (ClassType classType : results) { assertThat(classType.getFQN().startsWith("java.nolang"), is(true)); } // begin results = indexer.findStartsWith("a"); assertThat(results, hasSize(1)); for (ClassType classType : results) { assertThat(classType.getFQN().startsWith("a"), is(true)); } }