@Test public void testRegister() throws Exception { Member newMember = new Member(); newMember.setName("Jane Doe"); newMember.setEmail("*****@*****.**"); newMember.setPhoneNumber("2125551234"); memberRegistration.register(newMember); assertNotNull(newMember.getId()); log.info(newMember.getName() + " was persisted with id " + newMember.getId()); }
@Test public void testRegister() throws Exception { Member newMember = new Member(); newMember.setName("Jane Doe"); newMember.setAddress("51 Sherbrooke West"); newMember.setSimplifyPublicKey("kjgafui7kj29"); newMember.setSimplifyPrivateKey("7ytiugexiuy29"); memberRegistration.register(newMember); assertNotNull(newMember.getId()); log.info(newMember.getName() + " was persisted with id " + newMember.getId()); }
/** * Creates a new member from the values provided. Performs validation, and will return a JAX-RS * response with either 200 ok, or with a map of fields, and related errors. * * @throws Exception */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createMember(Member member) throws Exception { // Validates member using bean validation validateMember(member); registration.register(member); // Create an "ok" response return Response.ok().build(); }
@Test public void registerMemberTest() throws Exception { Assert.assertNotNull(memberRegistration); Assert.assertNotNull(memberRepository); Member member = new Member(); member.setName("John Doe"); member.setEmail("*****@*****.**"); member.setPhoneNumber("1234567890"); memberRegistration.register(member); Member found = memberRepository.findByEmail("*****@*****.**"); Assert.assertNotNull(found); Assert.assertEquals("Dummy name", found.getName()); }