use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertToEntityWhenHasConverter.
@Test
public void shouldConvertToEntityWhenHasConverter() {
Worker worker = new Worker();
Job job = new Job();
job.setCity("Sao Paulo");
job.setDescription("Java Developer");
worker.setName("Bob");
worker.setSalary(new Money("BRL", BigDecimal.TEN));
worker.setJob(job);
DocumentEntity entity = converter.toDocument(worker);
Worker worker1 = converter.toEntity(entity);
assertEquals(worker.getSalary(), worker1.getSalary());
assertEquals(job.getCity(), worker1.getJob().getCity());
assertEquals(job.getDescription(), worker1.getJob().getDescription());
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertEmbeddableLazily.
@Test
public void shouldConvertEmbeddableLazily() {
DocumentEntity entity = DocumentEntity.of("Worker");
entity.add("name", "Otavio");
entity.add("money", "BRL 10");
Worker worker = converter.toEntity(entity);
assertEquals("Otavio", worker.getName());
assertEquals(new Money("BRL", BigDecimal.TEN), worker.getSalary());
assertNull(worker.getJob());
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertToEntityWhenHasConverter.
@Test
public void shouldConvertToEntityWhenHasConverter() {
Worker worker = new Worker();
Job job = new Job();
job.setCity("Sao Paulo");
job.setDescription("Java Developer");
worker.setName("Bob");
worker.setSalary(new Money("BRL", BigDecimal.TEN));
worker.setJob(job);
ColumnEntity entity = converter.toColumn(worker);
Worker worker1 = converter.toEntity(entity);
assertEquals(worker.getSalary(), worker1.getSalary());
assertEquals(job.getCity(), worker1.getJob().getCity());
assertEquals(job.getDescription(), worker1.getJob().getDescription());
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectOrderAsc.
@Test
public void shouldSelectOrderAsc() {
DocumentQuery query = mapperBuilder.selectFrom(Worker.class).orderBy("salary").asc().build();
DocumentQuery queryExpected = select().from("Worker").orderBy("money").asc().build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldQueryByEmbeddable.
@Test
public void shouldQueryByEmbeddable() {
DocumentQuery query = mapperBuilder.selectFrom(Worker.class).where("job.city").eq("Salvador").build();
DocumentQuery queryExpected = select().from("Worker").where("city").eq("Salvador").build();
assertEquals(queryExpected, query);
}
Aggregations