AttributeBytecodeGenerator { static void ensureFieldExists(Class<?> pojoClass, Class<?> attributeValueType, String fieldName, String attributeName) { try { while (pojoClass != null) { try { pojoClass.getDeclaredField(fieldName); return; } catch (NoSuchFieldException e) { pojoClass = pojoClass.getSuperclass(); } } throw new NoSuchFieldException(fieldName); } catch (Exception e) { throw new IllegalStateException(getExceptionMessage(pojoClass, attributeValueType, attributeName), e); } }  static Map<String, ? extends Attribute<O, ?>> createAttributes(Class<O> pojoClass); @SuppressWarnings("unchecked") static Map<String, ? extends Attribute<O, ?>> createAttributes(Class<O> pojoClass, MemberFilter memberFilter); @SuppressWarnings("unchecked") static Map<String, ? extends Attribute<O, ?>> createAttributes(Class<O> pojoClass, MemberFilter memberFilter, Function<Member, String> attributeNameProducer); @SuppressWarnings("unchecked") static Class<? extends SimpleAttribute<O, A>> generateSimpleAttributeForField(Class<O> pojoClass, Class<A> attributeValueType, String fieldName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends SimpleAttribute<O, A>> generateSimpleAttributeForGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends SimpleAttribute<O, A>> generateSimpleAttributeForParameterizedGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String getterParameter, String attributeName); @SuppressWarnings("unchecked") static Class<? extends SimpleNullableAttribute<O, A>> generateSimpleNullableAttributeForField(Class<O> pojoClass, Class<A> attributeValueType, String fieldName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends SimpleNullableAttribute<O, A>> generateSimpleNullableAttributeForGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends SimpleNullableAttribute<O, A>> generateSimpleNullableAttributeForParameterizedGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String getterParameter, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueAttribute<O, A>> generateMultiValueAttributeForField(Class<O> pojoClass, Class<A> attributeValueType, String fieldName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueAttribute<O, A>> generateMultiValueAttributeForGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueAttribute<O, A>> generateMultiValueAttributeForParameterizedGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String getterParameter, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueNullableAttribute<O, A>> generateMultiValueNullableAttributeForField(Class<O> pojoClass, Class<A> attributeValueType, String fieldName, boolean componentValuesNullable, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueNullableAttribute<O, A>> generateMultiValueNullableAttributeForGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, boolean componentValuesNullable, String attributeName); @SuppressWarnings("unchecked") static Class<? extends MultiValueNullableAttribute<O, A>> generateMultiValueNullableAttributeForParameterizedGetter(Class<O> pojoClass, Class<A> attributeValueType, String getterMethodName, String getterParameter, boolean componentValuesNullable, String attributeName);  }
@Test(expected = IllegalStateException.class) public void testEnsureFieldExists_Negative() { ensureFieldExists(String.class, Integer.class, "xxxxxxxxxx", "na"); }