use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnTemplateTest method shouldReturnErrorWhenThereMoreThanASingleResult.
@Test
public void shouldReturnErrorWhenThereMoreThanASingleResult() {
Assertions.assertThrows(NonUniqueResultException.class, () -> {
ColumnEntity columnEntity = ColumnEntity.of("Person");
columnEntity.addAll(Stream.of(columns).collect(Collectors.toList()));
Mockito.when(managerMock.select(any(ColumnQuery.class))).thenReturn(Arrays.asList(columnEntity, columnEntity));
ColumnQuery query = select().from("person").build();
subject.singleResult(query);
});
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnTemplateTest method shouldUpdate.
@Test
public void shouldUpdate() {
ColumnEntity columnEntity = ColumnEntity.of("Person");
columnEntity.addAll(Stream.of(columns).collect(Collectors.toList()));
Mockito.when(managerMock.update(any(ColumnEntity.class))).thenReturn(columnEntity);
subject.update(this.person);
verify(managerMock).update(captor.capture());
verify(columnEventPersistManager).firePostEntity(any(Person.class));
verify(columnEventPersistManager).firePreEntity(any(Person.class));
verify(columnEventPersistManager).firePreColumn(any(ColumnEntity.class));
verify(columnEventPersistManager).firePostColumn(any(ColumnEntity.class));
ColumnEntity value = captor.getValue();
assertEquals("Person", value.getName());
assertEquals(4, value.getColumns().size());
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnTemplateTest method shouldInsertEntities.
@Test
public void shouldInsertEntities() {
ColumnEntity columnEntity = ColumnEntity.of("Person");
columnEntity.addAll(Stream.of(columns).collect(Collectors.toList()));
Mockito.when(managerMock.insert(any(ColumnEntity.class))).thenReturn(columnEntity);
subject.insert(Arrays.asList(person, person));
verify(managerMock, times(2)).insert(any(ColumnEntity.class));
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class ColumnEntityPostPersistTest method shouldReturnInstance.
@Test
public void shouldReturnInstance() {
ColumnEntity entity = ColumnEntity.of("columnFamily");
ColumnEntityPostPersist postPersist = ColumnEntityPostPersist.of(entity);
assertEquals(entity, postPersist.getEntity());
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class ColumnEntityPrePersistTest method shouldReturnInstance.
@Test
public void shouldReturnInstance() {
ColumnEntity entity = ColumnEntity.of("columnFamily");
ColumnEntityPrePersist prePersist = ColumnEntityPrePersist.of(entity);
assertEquals(entity, prePersist.getEntity());
}
Aggregations