Code example for Field

Methods: isAnnotationPresent

0
	private static final DateMidnight DATA_CRIACAO = new DateMidnight();
 
	@Test 
	public void testIdFieldAnnotations() throws SecurityException, NoSuchFieldException{ 
		Field idField = ForTest.class.getSuperclass().getDeclaredField(ID_FIELD_NAME);
		Assert.assertTrue(idField.isAnnotationPresent(Id.class));
		Assert.assertTrue(idField.isAnnotationPresent(GeneratedValue.class));
	} 
	 
	@Test 
	public void testGettersAndSetters() { 
		ForTest forTestClass = new ForTest();
		Assert.assertEquals(CLASS_ID, forTestClass.getId());
		Assert.assertEquals(DATA_CRIACAO, forTestClass.getDataCriacao());
	} 
	 
	private class ForTest extends ForgeObject{ 
 
		{ 
			setId(CLASS_ID);
			setDataCriacao(DATA_CRIACAO);