NinjaBaseDirectoryResolver { public String resolveApplicationClassName(String classLocationAsDefinedByNinja) { if (applicationModulesBasePackage.isPresent()) { return new StringBuilder() .append(applicationModulesBasePackage.get()) .append('.') .append(classLocationAsDefinedByNinja) .toString(); } else { return classLocationAsDefinedByNinja; } } @Inject  NinjaBaseDirectoryResolver(NinjaProperties ninjaProperties); String resolveApplicationClassName(String classLocationAsDefinedByNinja);  }
@Test public void testThatCorrectValueIsReturnedWithDefaultSetup() { NinjaBaseDirectoryResolver ninjaBaseDirectoryResolver = new NinjaBaseDirectoryResolver(ninjaProperties); String result = ninjaBaseDirectoryResolver.resolveApplicationClassName("conf.Filters"); assertThat(result, Matchers.equalTo("conf.Filters")); }
@Test public void testThatCorrectValueIsReturnedWithDifferentBasePackage() { Mockito.when(ninjaProperties.get(NinjaConstant.APPLICATION_MODULES_BASE_PACKAGE)).thenReturn("com.example"); NinjaBaseDirectoryResolver ninjaBaseDirectoryResolver = new NinjaBaseDirectoryResolver(ninjaProperties); String result = ninjaBaseDirectoryResolver.resolveApplicationClassName("conf.Filters"); assertThat(result, Matchers.equalTo("com.example.conf.Filters")); }