MethodMetaExtractor { static String trimAccessModifierFromMethodSignatureArea(String methodSignatureArea) { Assertion.on("methodSignatureArea").mustNotBeNull(methodSignatureArea); String regExpForAccessModifier_public = AccessModifierDetector.RegExp.Prefix + "public" + "\\s+"; String regExpForAccessModifier_protected = AccessModifierDetector.RegExp.Prefix + "protected" + "\\s+"; String methodSignatureAreaWithoutAccessModifier = methodSignatureArea.replaceAll(StringValue.Tab, StringValue.Space).replaceAll(regExpForAccessModifier_public, StringValue.Space).replaceAll( regExpForAccessModifier_protected, StringValue.Space).replaceAll("\\sfinal\\s", StringValue.Space); return methodSignatureAreaWithoutAccessModifier; } MethodMetaExtractor(Configuration config); MethodMetaExtractor initialize(String sourceCodeString); MethodMetaExtractor initialize(ClassMeta classMeta); MethodMetaExtractor initialize(ClassMeta classMeta, String sourceCodeString); List<MethodMeta> extract(String sourceCodeString);  }
@Test public void trimAccessModifierFromMethodSignatureArea_A$String() throws Exception { String methodSignatureArea = "} public static void main(String[] args) {"; String actual = MethodMetaExtractor.trimAccessModifierFromMethodSignatureArea(methodSignatureArea); String expected = " static void main(String[] args) {"; assertEquals(expected, actual); }
@Test public void trimAccessModifierFromMethodSignatureArea_A$String_StringIsNull() throws Exception { String methodSignatureArea = null; try { MethodMetaExtractor.trimAccessModifierFromMethodSignatureArea(methodSignatureArea); fail(); } catch (JUnitHelperCoreException e) { } }
@Test public void trimAccessModifierFromMethodSignatureArea_A$String_StringIsEmpty() throws Exception { String methodSignatureArea = ""; String actual = MethodMetaExtractor.trimAccessModifierFromMethodSignatureArea(methodSignatureArea); String expected = ""; assertThat(actual, is(equalTo(expected))); }