### Question:
Reflections { String extractJavaFileName(File sourceDirectory, File file) { String diff = file.getAbsolutePath().substring(sourceDirectory.getAbsolutePath().length()); String className = FilenameUtils.separatorsToUnix(diff).replace('/', '.'); if (className.startsWith(".")) { className = className.substring(1); } if (className.endsWith(".java")) { className = className.substring(0, className.length() - ".java".length()); } return className; } Reflections(); Set<Class<?>> getTypesAnnotatedWith(Class<? extends Annotation> annotation); Set<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation); Set<Field> getFieldsAnnotatedWith(Class<? extends Annotation> annotation); Set<Class<? extends T>> getSubTypesOf(Class<T> clazz); boolean isInspecting(Class<?> clazz); int getAmountOfInspectedClasses();  }### Answer:
@Test public void extractJavaFileName_class_TestMe_in_subpackage_com_daimler_sechub_reflections() { File file = new File("."); File sourceFolder = new File(file, "subproject1/src/main/java"); File classFile = new File(sourceFolder, "com/daimler/sechub/reflections/TestMe.java"); String result = reflectionsToTest.extractJavaFileName(sourceFolder, classFile); assertEquals("com.daimler.sechub.reflections.TestMe", result); }
@Test public void extractJavaFileName_class_TestMe_in_default_package() { File file = new File("."); File sourceFolder = new File(file, "subproject1/src/main/java"); File classFile = new File(sourceFolder, "TestMe.java"); String result = reflectionsToTest.extractJavaFileName(sourceFolder, classFile); assertEquals("TestMe", result); }