Package org.monjo.example

Examples of org.monjo.example.SubClassPojo


    monjo.removeAll();
    ObjectId objectId = monjo.insert(fixture);

    Monjo<ObjectId, SubClassPojo> monjo2 = new Monjo<ObjectId, SubClassPojo>(getMongoDB(), SubClassPojo.class, "simplePojo",
        new NullCommand<SubClassPojo>());
    SubClassPojo classPojo = monjo2.findOne(objectId);
    SimplePojoTest.compareTwoSimplePojos(fixture, classPojo);
  }
View Full Code Here


  @Test
  public void shouldUpdateSimpleObject() {
    Status thing = Status.Delta;

    SubClassPojo pojo = new SubClassPojo();
    pojo.setAnIntegerField(44);
    pojo.setaLongField(44L);
    pojo.setaDoubleField(44.0);
    pojo.setStatus(thing);
    String extraInfo = "this extra info";
    pojo.setExtraProperty(extraInfo);

    Monjo<ObjectId, SubClassPojo> monjo = new Monjo<ObjectId, SubClassPojo>(getMongoDB(), SubClassPojo.class, "simplePojo",
        new NullCommand<SubClassPojo>());
    monjo.removeAll();
    ObjectId objectId = monjo.insert(pojo);

    SimplePOJO simplePOJO = PojoBuilder.createSimplePojo();
    simplePOJO.setId(objectId);

    Monjo<ObjectId, SimplePOJO> monjo2 = new Monjo<ObjectId, SimplePOJO>(getMongoDB(), SimplePOJO.class, "simplePojo",
        new NullCommand<SimplePOJO>());
    monjo2.update(simplePOJO);

    SimplePOJO fixture = PojoBuilder.createSimplePojo();
    simplePOJO = monjo.findOne(objectId);
    assertTrue(fixture.getaDoubleField().equals(simplePOJO.getaDoubleField()));
    assertTrue(fixture.getAnIntegerField().equals(simplePOJO.getAnIntegerField()));
    assertTrue(fixture.getaLongField().equals(simplePOJO.getaLongField()));
    assertTrue(Status.Delta.equals(simplePOJO.getStatus()));

    SubClassPojo classPojo = monjo.findOne(objectId);
    assertTrue(fixture.getaDoubleField().equals(classPojo.getaDoubleField()));
    assertTrue(fixture.getAnIntegerField().equals(classPojo.getAnIntegerField()));
    assertTrue(fixture.getaLongField().equals(classPojo.getaLongField()));
    assertTrue(Status.Delta.equals(classPojo.getStatus()));
    assertTrue(extraInfo.equals(classPojo.getExtraProperty()));
  }
View Full Code Here

TOP

Related Classes of org.monjo.example.SubClassPojo

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.