AccessModifierDetector { public static boolean isPrivate(String methodSignature) { return methodSignature != null && 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 isPrivate_A$String_true() throws Exception { String methodSignature = "private void _do(String name) {"; boolean actual = AccessModifierDetector.isPrivate(methodSignature); boolean expected = true; assertEquals(expected, actual); }
@Test public void isPrivate_A$String_false() throws Exception { String methodSignature = "void _do(String name) {"; boolean actual = AccessModifierDetector.isPrivate(methodSignature); boolean expected = false; assertEquals(expected, actual); }
@Test public void isPrivate_A$String_StringIsNull() throws Exception { String methodSignature = null; boolean actual = AccessModifierDetector.isPrivate(methodSignature); boolean expected = false; assertThat(actual, is(equalTo(expected))); }
@Test public void isPrivate_A$String_StringIsEmpty() throws Exception { String methodSignature = ""; boolean actual = AccessModifierDetector.isPrivate(methodSignature); boolean expected = false; assertThat(actual, is(equalTo(expected))); }