@Test public void should_convert_user_secret_question_without_question() { SecurityUserQuestionEntity securityUserQuestion = new SecurityUserQuestionEntity(); securityUserQuestion.setIdtPerson(1L); securityUserQuestion.setDesSecurityAnswer("AAA"); SecurityQuestion item = SecurityQuestionBuilder.buildResourceItem(securityUserQuestion); Assert.assertEquals(new Long(1L), item.getIdtPerson()); Assert.assertNull(item.getIdtSecretQuestion()); Assert.assertNull(item.getDesSecretQuestion()); Assert.assertEquals("AAA", item.getDesSecretAnswer()); }
@Test public void should_convert_user_secret_question_with_secrect_question_fixed() { SecurityQuestionEntity securityQuestion = new SecurityQuestionEntity(); securityQuestion.setIdtSecurityQuestion(123456L); securityQuestion.setDesSecretQuestion("AAA?"); securityQuestion.setFlgFixed(Boolean.TRUE); SecurityUserQuestionEntity securityUserQuestion = new SecurityUserQuestionEntity(); securityUserQuestion.setIdtPerson(1L); securityUserQuestion.setDesSecurityAnswer("AAA"); securityUserQuestion.setSecurityQuestion(securityQuestion); SecurityQuestion item = SecurityQuestionBuilder.buildResourceItem(securityUserQuestion); Assert.assertEquals(new Long(1L), item.getIdtPerson()); Assert.assertEquals(new Long(123456L), item.getIdtSecretQuestion()); Assert.assertEquals("AAA?", item.getDesSecretQuestion()); Assert.assertEquals("AAA", item.getDesSecretAnswer()); Assert.assertEquals("FIXED", item.getType()); }