JBBPMapperException extends JBBPException { @Override public String toString() { return this.getMessage() + " [ " + this.getMappingClassField() + " -> " + this.getField() + ']'; } JBBPMapperException(final String message, final JBBPAbstractField field, final Class<?> mappingClass, final Field mappingClassField, final Throwable cause); JBBPAbstractField getField(); Class<?> getMappingClass(); Field getMappingClassField(); @Override String toString();  }
@Test public void testToString() throws Exception { final Class<?> clazz = Integer.class; final Field clazzField = Integer.class.getDeclaredFields()[0]; assertNotNull(clazzField); final JBBPMapperException ex = new JBBPMapperException(this.message, this.field, clazz, clazzField, this.cause); assertTrue(ex.toString().contains(clazzField.toString())); }