FieldUtil { public static String determineFieldName(@Nonnull final String methodName) { Check.notEmpty(methodName, "methodName"); final Matcher m = PATTERN.matcher(methodName); Check.stateIsTrue(m.find(), "passed method name '%s' is not applicable", methodName); return m.group(2).substring(0, 1).toLowerCase() + m.group(2).substring(1); } private  FieldUtil(); static AccessorPrefix determineAccessorPrefix(@Nonnull final String methodName); static String determineFieldName(@Nonnull final String methodName);  }
@Test(expected = IllegalEmptyArgumentException.class) public void determineFieldName_isEmpty() { FieldUtil.determineFieldName(""); }
@Test(expected = IllegalStateOfArgumentException.class) public void determineFieldName_isEmptyAfterTrim() { FieldUtil.determineFieldName(" "); }
@Test(expected = IllegalNullArgumentException.class) public void determineFieldName_isNull() { FieldUtil.determineFieldName(null); }
@Test public void determineFieldName_successful() { assertEquals("field", FieldUtil.determineFieldName("getField")); assertEquals("field", FieldUtil.determineFieldName("hasField")); assertEquals("field", FieldUtil.determineFieldName("isField")); assertEquals("field123", FieldUtil.determineFieldName("getField123")); assertEquals("field123", FieldUtil.determineFieldName("hasField123")); assertEquals("field123", FieldUtil.determineFieldName("isField123")); }