Package org.bitbucket.andyrobr.clever.models

Examples of org.bitbucket.andyrobr.clever.models.School


        assertNotNull(schoolsInDistrict);
        assertTrue(schoolsInDistrict.size() == 1);

        assertEquals(schoolsInDistrict.get(0), schools.get(0));

        School school = clever.getSchool(schoolsInDistrict.get(0).getId());

        assertEquals(school, schools.get(0));
    }
View Full Code Here


    }

    @Test
    public void testGetTeachersFromSchool() throws Exception
    {
        School school = clever.getSchools().get(0);

        List<Teacher> teachers = clever.getTeachersFromSchool(school.getId());

        assertNotNull(teachers);
        assertTrue(teachers.size() == 1);

        School teacherSchool = clever.getSchoolFromTeacher(teachers.get(0).getId());

        assertEquals(teacherSchool, school);
    }
View Full Code Here

    }

    @Test
    public void testGetStudentsFromSchool() throws Exception
    {
        School school = clever.getSchools().get(0);

        List<Student> students = clever.getStudentsFromSchool(school.getId());

        assertNotNull(students);
        assertTrue(students.size() == 1);

        School studentSchool = clever.getSchoolFromStudent(students.get(0).getId());

        assertEquals(studentSchool, school);
    }
View Full Code Here

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
        School school = mapper.readValue(node, School.class);

        // Apply nested properties by hand
        JsonNode locationNode = node.get("location");
        JsonNode principalNode = node.get("principal");

        school.setAddress(locationNode.get("address").getTextValue());
        school.setCity(locationNode.get("city").getTextValue());
        school.setState(locationNode.get("state").getTextValue());
        school.setPostalCode(locationNode.get("zip").getTextValue());

        school.setPrincipalName(principalNode.get("name").getTextValue());
        school.setPrincipalEmail(principalNode.get("email").getTextValue());

        return school;
    }
View Full Code Here

TOP

Related Classes of org.bitbucket.andyrobr.clever.models.School

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.