Search in sources :

Example 1 with User

use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.

the class DefaultKeyValueEntityConverterTest method shouldReturnErrorWhenTheKeyIsNull.

@Test
public void shouldReturnErrorWhenTheKeyIsNull() {
    Assertions.assertThrows(NullPointerException.class, () -> {
        User user = new User(null, "name", 24);
        converter.toKeyValue(user);
    });
}
Also used : User(org.jnosql.artemis.model.User) Test(org.junit.jupiter.api.Test)

Example 2 with User

use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.

the class DefaultKeyValueEntityConverterTest method shouldConvertValueToEntity.

@Test
public void shouldConvertValueToEntity() {
    User expectedUser = new User("nickname", "name", 21);
    User user = converter.toEntity(User.class, Value.of(expectedUser));
    assertEquals(expectedUser, user);
}
Also used : User(org.jnosql.artemis.model.User) Test(org.junit.jupiter.api.Test)

Example 3 with User

use of org.jnosql.artemis.model.User in project jnosql-artemis 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);
}
Also used : User(org.jnosql.artemis.model.User) Test(org.junit.jupiter.api.Test)

Example 4 with User

use of org.jnosql.artemis.model.User in project jnosql-artemis 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);
}
Also used : User(org.jnosql.artemis.model.User) Test(org.junit.jupiter.api.Test)

Example 5 with User

use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.

the class DefaultKeyValueTemplateTest method shouldGetIterable.

@Test
public void shouldGetIterable() {
    User user = new User(KEY, "otavio", 27);
    when(manager.get(singletonList(KEY))).thenReturn(singletonList(Value.of(user)));
    List<User> userOptional = stream(subject.get(singletonList(KEY), User.class).spliterator(), false).collect(toList());
    assertFalse(userOptional.isEmpty());
    assertEquals(user, userOptional.get(0));
}
Also used : User(org.jnosql.artemis.model.User) Test(org.junit.jupiter.api.Test)

Aggregations

User (org.jnosql.artemis.model.User)21 Test (org.junit.jupiter.api.Test)19 KeyValueEntity (org.jnosql.diana.api.key.KeyValueEntity)4 Duration (java.time.Duration)2 Produces (javax.enterprise.inject.Produces)2 Person (org.jnosql.artemis.model.Person)2 BucketManager (org.jnosql.diana.api.key.BucketManager)2