Package org.springbyexample.schema.beans.person

Examples of org.springbyexample.schema.beans.person.PersonResponse


    @Autowired
    private ContactService service;
       
    @Test
    public void testFindById() {
        PersonResponse response = service.findById(FIRST_ID);
        Person person = response.getResults();

        testPersonOne(person);
    }
View Full Code Here


    @Test
    public void testCreate() {
        String firstName = "Jack";
        String lastName = "Johnson";
       
        PersonResponse response = createPerson(firstName, lastName);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();
       
        // test saved person
        testPerson(person,
                   firstName, lastName);
View Full Code Here

        assertEquals("Number of persons should be " + expectedCount + ".", expectedCount, persons.size());
    }

    @Test
    public void testUpdate() {
        PersonResponse response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();
       
        testPersonOne(person);
       
        String lastName = "Jones";
        person.setLastName(lastName);

        service.update(person);

        response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
       
        person = response.getResults();
       
        testPersonOne(person, lastName);
    }
View Full Code Here

    @Test
    public void testDelete() {
        service.delete(new Person().withId(FIRST_ID));

        // person should be null after delete
        PersonResponse response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();

        assertNull("Person is not null.", person);
    }
View Full Code Here

        Person person = new Person();

        person.setFirstName(firstName);
        person.setLastName(lastName);
       
        PersonResponse response = service.create(person);
       
        return response;
    }
View Full Code Here

    @Override
    @RequestMapping(value = FIND_BY_ID_REQUEST, method = RequestMethod.GET)
    public PersonResponse findById(@PathVariable(ID_VAR) long id) {
        logger.info("Find person.  id={}", id);

        return new PersonResponse()
                    .withResult(new Person().withId(ID).withFirstName(FIRST_NAME).withLastName(LAST_NAME));
    }
View Full Code Here

    @Override
    @RequestMapping(value = SAVE_REQUEST, method = RequestMethod.POST)
    public PersonResponse save(@RequestBody Person request) {
        logger.info("Save person.  id={}", request.getId());

        return new PersonResponse().withMessageList(
                    new Message().withMessageType(MessageType.INFO)
                                 .withMessage(String.format("Successfully saved record.  id='%d'", request.getId())))
                    .withResult(request);
    }
View Full Code Here

    @Autowired
    private PersonClient client = null;

    @Test
    public void testFindById() {
        PersonResponse response = client.findById(ID);
       
        assertNotNull("Response is null.", response);
       
        verifyRecord(response.getResult());
    }
View Full Code Here

    @Test
    public void testSave() {
        Person request = new Person().withId(ID).withFirstName(FIRST_NAME).withLastName(LAST_NAME);
       
        PersonResponse response = client.save(request);
       
        assertNotNull("Response is null.", response);
       
        verifyRecord(response.getResult());

        int expectedCount = 1;
        assertEquals("messageList.size", expectedCount, response.getMessageList().size());

        logger.info(response.getMessageList().get(0).getMessage());
    }
View Full Code Here

        verifySmallRecord(results.get(0), false);
    }

    @Test
    public void testSmallFindById() {
        PersonResponse response = client.smallFindById(id);
       
        assertNotNull("Response is null.", response);

        verifySmallRecord(response.getResults(), false);
    }
View Full Code Here

TOP

Related Classes of org.springbyexample.schema.beans.person.PersonResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.