ImportListBuilder { @Nonnull public List<DAImport> getImports(@Nonnull final String currentPackage) { checkNotNull(currentPackage, "currentPackage can not be null. Use the empty string for the default package"); if (imports.isEmpty()) { return Collections.emptyList(); } Map<DAName, List<DAImport>> indexBySimpleName = indexImportsBySimpleName(imports); return from(indexBySimpleName.values()) .transform(new ImportSelector(currentPackage)) .filter(Predicates.notNull()) .filter(FILTER_OUT_MAPPER_DEPENDENCY_ANNOTATION_IMPORT) .toList(); }  @Nonnull List<DAImport> getImports(@Nonnull final String currentPackage);  }
@Test(expectedExceptions = NullPointerException.class) public void getImports_throws_npe_for_null_currentPackage_argument() throws Exception { underTest.getImports(null); }
@Test public void getImports_returns_empty_list_when_builder_is_empty() throws Exception { assertThat(new ImportListBuilder().getImports("com.acme")).isEmpty(); assertThat(new ImportListBuilder().getImports("")).isEmpty(); assertThat(new ImportListBuilder().getImports("acme")).isEmpty(); }
@Test public void getImports_does_not_enforce_currentPackage_argument_to_be_a_valid_package_name() throws Exception { underTest.getImports("Fo%o"); }