FieldName { public static String of(final String name) { return of(callingClass(), name); }  static String of(final String name); static String of(final Class<?> clazz, final String name);  }
@Test public void testFieldNameOf() throws Exception { String name = "foo"; junit.framework.Assert.assertEquals("foo", FieldName.of("foo")); junit.framework.Assert.assertEquals("bar", FieldName.of("bar")); new AssertedFailure(FieldName.FieldNameNotFoundException.class) { @Override protected void thisMustFail() throws Throwable { FieldName.of("buh"); } }; junit.framework.Assert.assertEquals("x", FieldName.of(E2.class, "x")); junit.framework.Assert.assertEquals("y", FieldName.of(E2.class, "y")); }
@Test public void testFieldNameOf() throws Exception { String name = "foo"; Assert.assertTrue("foo".equals(FieldName.of("foo"))); Assert.assertTrue("bar".equals(FieldName.of("bar"))); new AssertedFailure(FieldName.FieldNameNotFoundException.class) { @Override protected void thisMustFail() throws Throwable { FieldName.of("buh"); } }; Assert.assertTrue("x".equals(FieldName.of(E2.class, "x"))); Assert.assertTrue("y".equals(FieldName.of(E2.class, "y"))); }