use of de.djuelg.neuronizer.domain.model.todolist.TodoListHeader in project Neuronizer by djuelg.
the class DisplayTodoListPresenterImpl method syncTodoList.
@Override
public void syncTodoList(FlexibleAdapter<AbstractFlexibleItem> adapter) {
List<IHeader> reversedHeaders = Lists.reverse(Optional.fromNullable(Lists.newArrayList(adapter.getHeaderItems())).or(new ArrayList<IHeader>(0)));
for (IHeader iHeader : reversedHeaders) {
TodoListHeaderViewModel vm = (TodoListHeaderViewModel) iHeader;
TodoListHeader header = vm.getHeader();
syncHeader(header, reversedHeaders.indexOf(vm), vm.isExpanded());
syncSubItems(Lists.newArrayList(adapter.getSectionItems(iHeader)));
}
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListHeader in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testHeaderDelete.
@Test
public void testHeaderDelete() {
TodoListHeader header = createHeader();
repository.insert(header);
repository.delete(header);
Optional<TodoListHeader> fromDb = repository.getHeaderById(header.getUuid());
assertFalse(fromDb.isPresent());
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListHeader in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testUpdateHeaderAsInsert.
@Test
public void testUpdateHeaderAsInsert() {
TodoListHeader header = createHeader();
repository.update(header);
Optional<TodoListHeader> fromDb = repository.getHeaderById(header.getUuid());
assertEquals(header, fromDb.get());
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListHeader in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testTodoListHeaderInsertTwice.
@Test
public void testTodoListHeaderInsertTwice() {
clearRealm();
TodoListHeader header = createHeader();
repository.insert(header);
boolean success = repository.insert(header);
assertFalse(success);
TodoListHeaderDAO dao = realm.where(TodoListHeaderDAO.class).equalTo("uuid", header.getUuid()).findFirst();
assertNotNull(dao);
fillRealm();
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListHeader in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testUpdateHeader.
@Test
public void testUpdateHeader() throws InterruptedException {
TodoListHeader header = createHeader();
repository.insert(header);
Thread.sleep(200);
repository.update(header.update("New Title", 0, false));
Optional<TodoListHeader> fromDb = repository.getHeaderById(header.getUuid());
assertEquals(header.getCreatedAt(), fromDb.get().getCreatedAt());
assertNotEquals(header.getChangedAt(), fromDb.get().getChangedAt());
assertNotEquals(header.getTitle(), fromDb.get().getTitle());
}
Aggregations