use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldQueryByEmbeddable.
@Test
public void shouldQueryByEmbeddable() {
ColumnQuery query = mapperBuilder.selectFrom(Worker.class).where("job.city").eq("Salvador").build();
ColumnQuery queryExpected = select().from("Worker").where("city").eq("Salvador").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertToColumnWhenHaConverter.
@Test
public void shouldConvertToColumnWhenHaConverter() {
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);
assertEquals("Worker", entity.getName());
assertEquals("Bob", entity.find("name").get().get());
assertEquals("Sao Paulo", entity.find("city").get().get());
assertEquals("Java Developer", entity.find("description").get().get());
assertEquals("BRL 10", entity.find("money").get().get());
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertEmbeddableLazily.
@Test
public void shouldConvertEmbeddableLazily() {
ColumnEntity entity = ColumnEntity.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());
Assertions.assertNull(worker.getJob());
}
Aggregations