Package org.monjo.example

Examples of org.monjo.example.SimplePOJOWithStringId


    Object documentId = document.get("_id");
    DBObject docFromMongo = getFromMongo(documentId);

    DocumentToObjectConverter<SimplePOJOWithStringId> converter = MonjoConverterFactory.getInstance().getDefaultDocumentConverter(SimplePOJOWithStringId.class);
    SimplePOJOWithStringId convertedObject = converter.from(docFromMongo).to();
    Class<?> idClass = convertedObject.getId().getClass();
    assertThat(idClass, classEqualTo(String.class));
    assertThat(convertedObject.getId(), is(equalTo(documentId)));
  }
View Full Code Here


  }

  @Test
  @SuppressWarnings("rawtypes")
  public void shouldPopulateStringIdIfDefined() {
    SimplePOJOWithStringId pojoWithStringId = new SimplePOJOWithStringId();
    pojoWithStringId.setId("abcd1234");
   
    ObjectToDocumentConverter<SimplePOJOWithStringId>
    converter = MonjoConverterFactory.getInstance()
    .configure(new DefaultNamingStrategy())
    .getDefaultObjectConverter(SimplePOJOWithStringId.class);
View Full Code Here

    assertThat(idClass, classEqualTo(ObjectId.class));
  }

  @SuppressWarnings("rawtypes")
  private void assertIdOfTypeStringIsPreserved() {
    SimplePOJOWithStringId pojoWithStringId = new SimplePOJOWithStringId();
    pojoWithStringId.setId("abcd1234");
   
    ObjectToDocumentConverter<SimplePOJOWithStringId>
    converter = MonjoConverterFactory.getInstance()
    .configure(new DefaultNamingStrategy())
    .getDefaultObjectConverter(SimplePOJOWithStringId.class);
View Full Code Here

TOP

Related Classes of org.monjo.example.SimplePOJOWithStringId

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.