@Test public void getAccessModifier_A$String_StringIsEmpty() throws Exception { MethodMetaExtractor target = new MethodMetaExtractor(config); String methodSignatureArea = ""; AccessModifier actual = target.getAccessModifier(methodSignatureArea); AccessModifier expected = AccessModifier.PackageLocal; assertThat(actual, is(equalTo(expected))); }
AccessModifier getAccessModifier(String methodSignatureArea) { if (AccessModifierDetector.isPublic(methodSignatureArea)) { return AccessModifier.Public; } else if (AccessModifierDetector.isProtected(methodSignatureArea)) { return AccessModifier.Protected; } else if (AccessModifierDetector.isPackageLocal(methodSignatureArea)) { return AccessModifier.PackageLocal; } else if (AccessModifierDetector.isPrivate(methodSignatureArea)) { return AccessModifier.Private; } else { return AccessModifier.Public; } }
MethodMetaExtractor { AccessModifier getAccessModifier(String methodSignatureArea) { if (AccessModifierDetector.isPublic(methodSignatureArea)) { return AccessModifier.Public; } else if (AccessModifierDetector.isProtected(methodSignatureArea)) { return AccessModifier.Protected; } else if (AccessModifierDetector.isPackageLocal(methodSignatureArea)) { return AccessModifier.PackageLocal; } else if (AccessModifierDetector.isPrivate(methodSignatureArea)) { return AccessModifier.Private; } else { return AccessModifier.Public; } } }
MethodMetaExtractor { AccessModifier getAccessModifier(String methodSignatureArea) { if (AccessModifierDetector.isPublic(methodSignatureArea)) { return AccessModifier.Public; } else if (AccessModifierDetector.isProtected(methodSignatureArea)) { return AccessModifier.Protected; } else if (AccessModifierDetector.isPackageLocal(methodSignatureArea)) { return AccessModifier.PackageLocal; } else if (AccessModifierDetector.isPrivate(methodSignatureArea)) { return AccessModifier.Private; } else { return AccessModifier.Public; } } MethodMetaExtractor(Configuration config); }
MethodMetaExtractor { AccessModifier getAccessModifier(String methodSignatureArea) { if (AccessModifierDetector.isPublic(methodSignatureArea)) { return AccessModifier.Public; } else if (AccessModifierDetector.isProtected(methodSignatureArea)) { return AccessModifier.Protected; } else if (AccessModifierDetector.isPackageLocal(methodSignatureArea)) { return AccessModifier.PackageLocal; } else if (AccessModifierDetector.isPrivate(methodSignatureArea)) { return AccessModifier.Private; } else { return AccessModifier.Public; } } MethodMetaExtractor(Configuration config); MethodMetaExtractor initialize(String sourceCodeString); MethodMetaExtractor initialize(ClassMeta classMeta); MethodMetaExtractor initialize(ClassMeta classMeta, String sourceCodeString); List<MethodMeta> extract(String sourceCodeString); }
MethodMetaExtractor { AccessModifier getAccessModifier(String methodSignatureArea) { if (AccessModifierDetector.isPublic(methodSignatureArea)) { return AccessModifier.Public; } else if (AccessModifierDetector.isProtected(methodSignatureArea)) { return AccessModifier.Protected; } else if (AccessModifierDetector.isPackageLocal(methodSignatureArea)) { return AccessModifier.PackageLocal; } else if (AccessModifierDetector.isPrivate(methodSignatureArea)) { return AccessModifier.Private; } else { return AccessModifier.Public; } } MethodMetaExtractor(Configuration config); MethodMetaExtractor initialize(String sourceCodeString); MethodMetaExtractor initialize(ClassMeta classMeta); MethodMetaExtractor initialize(ClassMeta classMeta, String sourceCodeString); List<MethodMeta> extract(String sourceCodeString);  }