Search in sources :

Example 1 with Bounds

use of org.activityinfo.server.database.hibernate.entity.Bounds in project activityinfo by bedatadriven.

the class AdminEntityMappingTest method testBounds.

@Test
public void testBounds() {
    Bounds bounds = new Bounds();
    bounds.setX1(1.0);
    bounds.setY1(2.0);
    bounds.setX2(3.0);
    bounds.setY2(4.0);
    AdminLevel level = new AdminLevel();
    level.setId(81);
    level.setName("My Level");
    AdminEntity parent = new AdminEntity();
    parent.setId(93);
    AdminEntity entity = new AdminEntity();
    entity.setLevel(level);
    entity.setParent(parent);
    entity.setBounds(bounds);
    AdminEntityDTO dto = mapper.map(entity, AdminEntityDTO.class);
    Assert.assertEquals("parentId", parent.getId(), dto.getParentId().intValue());
    Assert.assertEquals("levelId", level.getId(), dto.getLevelId());
    Assert.assertNotNull("bounds", dto.getBounds());
    Assert.assertEquals("x1", bounds.getX1(), dto.getBounds().getMinLon());
    Assert.assertEquals("y1", bounds.getY1(), dto.getBounds().getMinLat());
    Assert.assertEquals("x2", bounds.getX2(), dto.getBounds().getMaxLon());
    Assert.assertEquals("y2", bounds.getY2(), dto.getBounds().getMaxLat());
}
Also used : AdminEntity(org.activityinfo.server.database.hibernate.entity.AdminEntity) AdminLevel(org.activityinfo.server.database.hibernate.entity.AdminLevel) AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO) Bounds(org.activityinfo.server.database.hibernate.entity.Bounds) Test(org.junit.Test)

Aggregations

AdminEntity (org.activityinfo.server.database.hibernate.entity.AdminEntity)1 AdminLevel (org.activityinfo.server.database.hibernate.entity.AdminLevel)1 Bounds (org.activityinfo.server.database.hibernate.entity.Bounds)1 AdminEntityDTO (org.activityinfo.shared.dto.AdminEntityDTO)1 Test (org.junit.Test)1