@Test public void shouldReturnProxyIdWithoutHittingDatabase() throws Exception { DataDefinition dataDefinition = mock(DataDefinition.class); ProxyEntity proxyEntity = new ProxyEntity(dataDefinition, 5L); Long id = proxyEntity.getId(); assertEquals(Long.valueOf(5), id); verify(dataDefinition, never()).get(anyLong()); }
@Override public Long getId(final Object databaseEntity) { return (Long) getField(databaseEntity, FIELD_ID); }
EntityServiceImpl implements EntityService { @Override public Long getId(final Object databaseEntity) { return (Long) getField(databaseEntity, FIELD_ID); } }
EntityServiceImpl implements EntityService { @Override public Long getId(final Object databaseEntity) { return (Long) getField(databaseEntity, FIELD_ID); }  }
EntityServiceImpl implements EntityService { @Override public Long getId(final Object databaseEntity) { return (Long) getField(databaseEntity, FIELD_ID); }  @Override Long getId(final Object databaseEntity); Boolean getActive(final Object databaseEntity); void setActive(final Object databaseEntity, final boolean active); @Override void setId(final Object databaseEntity, final Long id); @Override void setField(final Object databaseEntity, final FieldDefinition fieldDefinition, final Object value); @Override Object getField(final Object databaseEntity, final FieldDefinition fieldDefinition); Object getField(final Object databaseEntity, final FieldDefinition fieldDefinition, final Entity performer); @Override Entity convertToGenericEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); Entity convertToGenericEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity,
            final Entity performer); @SuppressWarnings("unchecked") @Override Object convertToDatabaseEntity(final InternalDataDefinition dataDefinition, final Entity genericEntity,
            final Object existingDatabaseEntity); }
EntityServiceImpl implements EntityService { @Override public Long getId(final Object databaseEntity) { return (Long) getField(databaseEntity, FIELD_ID); }  @Override Long getId(final Object databaseEntity); Boolean getActive(final Object databaseEntity); void setActive(final Object databaseEntity, final boolean active); @Override void setId(final Object databaseEntity, final Long id); @Override void setField(final Object databaseEntity, final FieldDefinition fieldDefinition, final Object value); @Override Object getField(final Object databaseEntity, final FieldDefinition fieldDefinition); Object getField(final Object databaseEntity, final FieldDefinition fieldDefinition, final Entity performer); @Override Entity convertToGenericEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); Entity convertToGenericEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity,
            final Entity performer); @SuppressWarnings("unchecked") @Override Object convertToDatabaseEntity(final InternalDataDefinition dataDefinition, final Entity genericEntity,
            final Object existingDatabaseEntity);  }