@Test public void createChildImportsTest() throws Exception { doReturn("tst.package").when(enclosedType).getPackageName(); doReturn("tstName").when(enclosedType).getName(); doReturn(ImmutableList.of()).when(enclosedType).getEnclosedTypes(); doReturn(ImmutableList.of(enclosedType)).when(generatedType).getEnclosedTypes(); final Map<String, String> generated = GeneratorUtil.createChildImports(generatedType); assertNotNull(generated); assertTrue(generated.get("tstName").equals("tst.package")); }
static Map<String, String> createChildImports(final GeneratedType genType) { Map<String, String> childImports = new LinkedHashMap<>(); for (GeneratedType genTypeChild : genType.getEnclosedTypes()) { createChildImports(genTypeChild); childImports.put(genTypeChild.getName(), genTypeChild.getPackageName()); } return childImports; }
GeneratorUtil { static Map<String, String> createChildImports(final GeneratedType genType) { Map<String, String> childImports = new LinkedHashMap<>(); for (GeneratedType genTypeChild : genType.getEnclosedTypes()) { createChildImports(genTypeChild); childImports.put(genTypeChild.getName(), genTypeChild.getPackageName()); } return childImports; } }
GeneratorUtil { static Map<String, String> createChildImports(final GeneratedType genType) { Map<String, String> childImports = new LinkedHashMap<>(); for (GeneratedType genTypeChild : genType.getEnclosedTypes()) { createChildImports(genTypeChild); childImports.put(genTypeChild.getName(), genTypeChild.getPackageName()); } return childImports; } private  GeneratorUtil(); }
GeneratorUtil { static Map<String, String> createChildImports(final GeneratedType genType) { Map<String, String> childImports = new LinkedHashMap<>(); for (GeneratedType genTypeChild : genType.getEnclosedTypes()) { createChildImports(genTypeChild); childImports.put(genTypeChild.getName(), genTypeChild.getPackageName()); } return childImports; } private  GeneratorUtil();  }
GeneratorUtil { static Map<String, String> createChildImports(final GeneratedType genType) { Map<String, String> childImports = new LinkedHashMap<>(); for (GeneratedType genTypeChild : genType.getEnclosedTypes()) { createChildImports(genTypeChild); childImports.put(genTypeChild.getName(), genTypeChild.getPackageName()); } return childImports; } private  GeneratorUtil();   }