use of jakarta.nosql.tck.entities.User in project jnosql-diana by eclipse.
the class DefaultKeyValueEntityConverterTest method shouldConvertAndFeedTheKeyValue.
@Test
public void shouldConvertAndFeedTheKeyValue() {
User expectedUser = new User("nickname", "name", 21);
User user = converter.toEntity(User.class, KeyValueEntity.of("nickname", new User(null, "name", 21)));
assertEquals(expectedUser, user);
}
use of jakarta.nosql.tck.entities.User in project jnosql-diana by eclipse.
the class DefaultKeyValueEntityConverterTest method shouldConvertToEntity.
@Test
public void shouldConvertToEntity() {
User expectedUser = new User("nickname", "name", 21);
User user = converter.toEntity(User.class, KeyValueEntity.of("user", expectedUser));
assertEquals(expectedUser, user);
}
use of jakarta.nosql.tck.entities.User in project jnosql-diana by eclipse.
the class DefaultKeyValueEntityConverterTest method shouldConvertAndFeedTheKeyValueIfKeyAndFieldAreDifferent.
@Test
public void shouldConvertAndFeedTheKeyValueIfKeyAndFieldAreDifferent() {
User expectedUser = new User("nickname", "name", 21);
User user = converter.toEntity(User.class, KeyValueEntity.of("nickname", new User("newName", "name", 21)));
assertEquals(expectedUser, user);
}
use of jakarta.nosql.tck.entities.User in project jnosql-diana by eclipse.
the class MockProducer method getBucketManager.
@Produces
public BucketManager getBucketManager() {
BucketManager bucketManager = Mockito.mock(BucketManager.class);
Person person = Person.builder().withName("Default").build();
when(bucketManager.get("key")).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get(10L)).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get("user")).thenReturn(Optional.of(Value.of(new User("Default", "Default", 10))));
return bucketManager;
}
use of jakarta.nosql.tck.entities.User in project jnosql-diana by eclipse.
the class MockProducer method getBucketManagerMock.
@Produces
@Database(value = DatabaseType.KEY_VALUE, provider = "keyvalueMock")
public BucketManager getBucketManagerMock() {
BucketManager bucketManager = Mockito.mock(BucketManager.class);
Person person = Person.builder().withName("keyvalueMock").build();
when(bucketManager.get("key")).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get(10L)).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get("user")).thenReturn(Optional.of(Value.of(new User("keyvalueMock", "keyvalueMock", 10))));
return bucketManager;
}
Aggregations