@Test public void testSaveCertification_InvalidDates() throws Exception { action.setCertification(certification); action.setEffectiveDate("12/2010"); action.setExpirationDate("11/2010"); assertEquals(ActionSupport.INPUT, action.saveCertification()); verifyZeroInteractions(mockProfileService); assertEquals( action.getText("error.expiration.date.before.effective"), action.getFieldErrors().get("expirationDate").get(0)); }
@Test public void testSaveCertification() throws Exception { when(mockDataService.getPersistentObject(eq(CertificationType.class), anyLong())) .thenReturn(CredentialFactory.getInstance().createCertification().getCertificationType()); action.setCertification(certification); action.setEffectiveDate("11/2010"); action.setExpirationDate("12/2010"); action.setCertificationTypeId(1234L); assertEquals(FirebirdUIConstants.RETURN_CLOSE_DIALOG, action.saveCertification()); verify(mockProfileService).saveCredential(profile, certification, FormTypeEnum.CV); }