Search in sources :

Example 1 with Car

use of jakarta.nosql.tck.entities.Car in project jnosql-diana by eclipse.

the class DefaultKeyValueEntityConverterTest method shouldConvertToKeyWhenThereIsConverterAnnotation.

@Test
public void shouldConvertToKeyWhenThereIsConverterAnnotation() {
    Car car = new Car();
    car.setPlate(Plate.of("123-BRL"));
    car.setName("Ferrari");
    KeyValueEntity entity = converter.toKeyValue(car);
    Assertions.assertEquals("123-BRL", entity.getKey());
    Assertions.assertEquals(car, entity.getValue());
}
Also used : Car(jakarta.nosql.tck.entities.Car) KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Example 2 with Car

use of jakarta.nosql.tck.entities.Car in project jnosql-diana by eclipse.

the class DefaultKeyValueEntityConverterTest method shouldConvertToEntityKeyWhenThereIsConverterAnnotation.

@Test
public void shouldConvertToEntityKeyWhenThereIsConverterAnnotation() {
    Car car = new Car();
    car.setName("Ferrari");
    Car ferrari = converter.toEntity(Car.class, KeyValueEntity.of("123-BRL", car));
    assertEquals(Plate.of("123-BRL"), ferrari.getPlate());
    assertEquals(car.getName(), ferrari.getName());
}
Also used : Car(jakarta.nosql.tck.entities.Car) Test(org.junit.jupiter.api.Test)

Aggregations

Car (jakarta.nosql.tck.entities.Car)2 Test (org.junit.jupiter.api.Test)2 KeyValueEntity (jakarta.nosql.keyvalue.KeyValueEntity)1