use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldUseAttributeConverter.
@Test
public void shouldUseAttributeConverter() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Worker.class).where("salary").eq(new Money("USD", BigDecimal.TEN)).build();
DocumentDeleteQuery queryExpected = delete().from("Worker").where("money").eq("USD 10").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldQueryByEmbeddable.
@Test
public void shouldQueryByEmbeddable() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Worker.class).where("job.city").eq("Salvador").build();
DocumentDeleteQuery queryExpected = delete().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 DefaultDocumentMapperSelectBuilderTest method shouldUseAttributeConverter.
@Test
public void shouldUseAttributeConverter() {
DocumentQuery query = mapperBuilder.selectFrom(Worker.class).where("salary").eq(new Money("USD", BigDecimal.TEN)).build();
DocumentQuery queryExpected = select().from("Worker").where("money").eq("USD 10").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectOrderDesc.
@Test
public void shouldSelectOrderDesc() {
DocumentQuery query = mapperBuilder.selectFrom(Worker.class).orderBy("salary").desc().build();
DocumentQuery queryExpected = select().from("Worker").orderBy("money").desc().build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.tck.entities.Worker in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertToDocumentWhenHaConverter.
@Test
public void shouldConvertToDocumentWhenHaConverter() {
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);
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());
}
Aggregations