### Question:
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);  }### Answer:
@Test public void shouldReturnProperId() throws Exception { SampleSimpleDatabaseObject databaseEntity = new SampleSimpleDatabaseObject(13L); Long id = entityService.getId(databaseEntity); assertEquals(Long.valueOf(13), id); }
@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()); }