### Question:
PropertyUtil { public static String getMemberNameFromMethod(Method method) { String name = method.getName(); if(name.startsWith("get") || name.startsWith("set")) { return name.substring(3); } if(name.startsWith("is") && Character.isUpperCase(name.charAt(2))) { return name.substring(2); } return name; }  static Boolean isMethodASetterProperty(Method method, Class clazz); static String getMemberNameFromMethod(Method method);  }### Answer:
@Test public void getting_member_name_returns_name_of_property_from_getter() throws NoSuchMethodException { Method property = TestClass.class.getMethod("getSymbol"); String memberName = PropertyUtil.getMemberNameFromMethod(property); assertEquals("Symbol", memberName); }
@Test public void getting_member_name_returns_name_of_property_from_setter() throws NoSuchMethodException { Method property = TestClass.class.getMethod("setSymbol", String.class); String memberName = PropertyUtil.getMemberNameFromMethod(property); assertEquals("Symbol", memberName); }
@Test public void getting_member_name_containing_get_returns_name_of_property_from_getter() throws NoSuchMethodException { Method property = TestClass.class.getMethod("getCourgette"); String memberName = PropertyUtil.getMemberNameFromMethod(property); assertEquals("Courgette", memberName); }
@Test public void getting_member_name_containing_set_returns_name_of_property_from_setter() throws NoSuchMethodException { Method property = TestClass.class.getMethod("setCassette", String.class); String memberName = PropertyUtil.getMemberNameFromMethod(property); assertEquals("Cassette", memberName); }
@Test public void getting_member_starting_with_is_returns_name_of_member() throws NoSuchMethodException { Method property = TestClass.class.getMethod("isAccepted"); String memberName = PropertyUtil.getMemberNameFromMethod(property); assertEquals("Accepted", memberName); }