Search in sources :

Example 1 with Job

use of jakarta.nosql.tck.entities.Job 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());
}
Also used : Money(jakarta.nosql.tck.entities.Money) DocumentEntity(jakarta.nosql.document.DocumentEntity) Worker(jakarta.nosql.tck.entities.Worker) Job(jakarta.nosql.tck.entities.Job) Test(org.junit.jupiter.api.Test)

Example 2 with Job

use of jakarta.nosql.tck.entities.Job 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());
}
Also used : Money(jakarta.nosql.tck.entities.Money) ColumnEntity(jakarta.nosql.column.ColumnEntity) Worker(jakarta.nosql.tck.entities.Worker) Job(jakarta.nosql.tck.entities.Job) Test(org.junit.jupiter.api.Test)

Example 3 with Job

use of jakarta.nosql.tck.entities.Job 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());
}
Also used : Money(jakarta.nosql.tck.entities.Money) DocumentEntity(jakarta.nosql.document.DocumentEntity) Worker(jakarta.nosql.tck.entities.Worker) Job(jakarta.nosql.tck.entities.Job) Test(org.junit.jupiter.api.Test)

Example 4 with Job

use of jakarta.nosql.tck.entities.Job 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());
}
Also used : Money(jakarta.nosql.tck.entities.Money) ColumnEntity(jakarta.nosql.column.ColumnEntity) Worker(jakarta.nosql.tck.entities.Worker) Job(jakarta.nosql.tck.entities.Job) Test(org.junit.jupiter.api.Test)

Aggregations

Job (jakarta.nosql.tck.entities.Job)4 Money (jakarta.nosql.tck.entities.Money)4 Worker (jakarta.nosql.tck.entities.Worker)4 Test (org.junit.jupiter.api.Test)4 ColumnEntity (jakarta.nosql.column.ColumnEntity)2 DocumentEntity (jakarta.nosql.document.DocumentEntity)2