AccessModifierDetector { public static boolean isPackageLocal(String methodSignature) { return methodSignature != null && !methodSignature.matches(RegExp.Prefix + "public" + RegExp.Suffix) && !methodSignature.matches(RegExp.Prefix + "protected" + RegExp.Suffix) && !methodSignature.matches(RegExp.Prefix + "private" + RegExp.Suffix); } private  AccessModifierDetector(); static boolean isPublic(String methodSignature); static boolean isProtected(String methodSignature); static boolean isPackageLocal(String methodSignature); static boolean isPrivate(String methodSignature);  }
@Test public void isPackageLocal_A$String_true() throws Exception { String methodSignature = " static final String hogehoge(List<String> list) throws Throwable { "; boolean actual = AccessModifierDetector.isPackageLocal(methodSignature); boolean expected = true; assertEquals(expected, actual); }
@Test public void isPackageLocal_A$String_false() throws Exception { String methodSignature = "private final String hogehoge(List<String> list) throws Throwable { "; boolean actual = AccessModifierDetector.isPackageLocal(methodSignature); boolean expected = false; assertEquals(expected, actual); }
@Test public void isPackageLocal_A$String_StringIsNull() throws Exception { String methodSignature = null; boolean actual = AccessModifierDetector.isPackageLocal(methodSignature); boolean expected = false; assertThat(actual, is(equalTo(expected))); }
@Test public void isPackageLocal_A$String_StringIsEmpty() throws Exception { String methodSignature = ""; boolean actual = AccessModifierDetector.isPackageLocal(methodSignature); boolean expected = true; assertThat(actual, is(equalTo(expected))); }