### Question:
GitKeepFileIndexer extends AbstractFileIndexer { @Override protected IndexBuilder fillIndexBuilder(final Path path) throws Exception { final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index {0}: module could not be resolved.", path.toUri().toString()); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index {0}: package could not be resolved.", path.toUri().toString()); return null; } return new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); }  @Override boolean supportsPath(final Path path);  }### Answer:
@Test public void testTheUsualBuild() throws Exception { final KieModule kieModule = mock(KieModule.class); doReturn(kieModule).when(moduleService).resolveModule(any(Path.class)); doReturn("Module Name").when(kieModule).getModuleName(); doReturn(getPathMock("default: final Package aPackage = mock(Package.class); doReturn("pkgName").when(aPackage).getPackageName(); doReturn(aPackage).when(moduleService).resolvePackage(any(Path.class)); final IndexBuilder indexBuilder = indexer.fillIndexBuilder(mainPath); final Set<KProperty<?>> properties = indexBuilder.build(); assertEquals(3, properties.size()); assertTrue(properties.contains(new KPropertyImpl<>(ModuleRootPathIndexTerm.TERM, "default: assertTrue(properties.contains(new KPropertyImpl<>(ModuleNameIndexTerm.TERM, "Module Name"))); assertTrue(properties.contains(new KPropertyImpl<>(PackageNameIndexTerm.TERM, "pkgName"))); }
@Test public void noModuleReturnsNull() throws Exception { doReturn(null).when(moduleService).resolvePackage(any()); assertNull(indexer.fillIndexBuilder(mainPath)); }
@Test public void noPackageReturnsNull() throws Exception { final KieModule kieModule = mock(KieModule.class); doReturn(kieModule).when(moduleService).resolveModule(any(Path.class)); doReturn(null).when(moduleService).resolvePackage(any(Path.class)); assertNull(indexer.fillIndexBuilder(mainPath)); }