use of org.jnosql.artemis.model.Zipcode in project jnosql-artemis by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertSubEntity.
@Test
public void shouldConvertSubEntity() {
Zipcode zipcode = new Zipcode();
zipcode.setZip("12321");
zipcode.setPlusFour("1234");
Address address = new Address();
address.setCity("Salvador");
address.setState("Bahia");
address.setStreet("Rua Engenheiro Jose Anasoh");
address.setZipcode(zipcode);
ColumnEntity columnEntity = converter.toColumn(address);
List<Column> columns = columnEntity.getColumns();
assertEquals("Address", columnEntity.getName());
assertEquals(5, columns.size());
assertEquals("Rua Engenheiro Jose Anasoh", getValue(columnEntity.find("street")));
assertEquals("Salvador", getValue(columnEntity.find("city")));
assertEquals("Bahia", getValue(columnEntity.find("state")));
assertEquals("12321", getValue(columnEntity.find("zip")));
assertEquals("1234", getValue(columnEntity.find("plusFour")));
}
use of org.jnosql.artemis.model.Zipcode in project jnosql-artemis by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertSubEntity.
@Test
public void shouldConvertSubEntity() {
Zipcode zipcode = new Zipcode();
zipcode.setZip("12321");
zipcode.setPlusFour("1234");
Address address = new Address();
address.setCity("Salvador");
address.setState("Bahia");
address.setStreet("Rua Engenheiro Jose Anasoh");
address.setZipcode(zipcode);
DocumentEntity documentEntity = converter.toDocument(address);
List<Document> documents = documentEntity.getDocuments();
assertEquals("Address", documentEntity.getName());
assertEquals(5, documents.size());
assertEquals("Rua Engenheiro Jose Anasoh", getValue(documentEntity.find("street")));
assertEquals("Salvador", getValue(documentEntity.find("city")));
assertEquals("Bahia", getValue(documentEntity.find("state")));
assertEquals("12321", getValue(documentEntity.find("zip")));
assertEquals("1234", getValue(documentEntity.find("plusFour")));
}
Aggregations