@Test public void testCertificationGetters() { Certification credential = CredentialFactory.getInstance().createCertification(); credential.getCertificationType().setId(1L); action.setCredential(new Degree()); assertNull(action.getCertification()); action.setCertification(new Certification()); when(mockDataService.getPersistentObject(CertificationType.class, null)).thenReturn(null); when(mockDataService.getPersistentObject(CertificationType.class, 1L)) .thenReturn(credential.getCertificationType()); action.setCertificationTypeId(null); assertNull(action.getCertificationTypeId()); action.setCertificationTypeId(1L); assertEquals(Long.valueOf(1L), action.getCertificationTypeId()); }