ImportsToFQCN { public String resolveFQCN(final String shortName) { for (Import item : imports) { if (item.getType().endsWith(shortName)) { return item.getType(); } } return shortName; } ImportsToFQCN(final List<Import> imports); String resolveFQCN(final String shortName);  }
@Test public void regular() { ArrayList<Import> imports = new ArrayList<>(); imports.add(new Import("org.test.Hello")); imports.add(new Import("org.test.Hello2")); imports.add(new Import("org.test.Hello3")); assertEquals("org.test.Hello", new ImportsToFQCN(imports).resolveFQCN("Hello")); }
@Test public void inPackage() { ArrayList<Import> imports = new ArrayList<>(); imports.add(new Import("org.test.Hello2")); imports.add(new Import("org.test.Hello3")); assertEquals("Hello", new ImportsToFQCN(imports).resolveFQCN("Hello")); }