Search in sources :

Example 1 with SimpleModel

use of org.fossasia.openevent.app.data.models.dto.SimpleModel in project open-event-orga-app by fossasia.

the class LoggerTest method shouldLogItem.

@Test
public void shouldLogItem() {
    SimpleModel simpleModel = new SimpleModel(2, "Title", "Description");
    Logger.logSuccess(simpleModel);
    verify(tree).i(contains(simpleModel.toString()));
}
Also used : SimpleModel(org.fossasia.openevent.app.data.models.dto.SimpleModel) Test(org.junit.Test)

Example 2 with SimpleModel

use of org.fossasia.openevent.app.data.models.dto.SimpleModel in project open-event-orga-app by fossasia.

the class LoggerTest method shouldLogList.

@Test
public void shouldLogList() {
    List simpleModel = Arrays.asList(new SimpleModel[] { new SimpleModel(2, "Title", "Description"), new SimpleModel(3, "New Title", "Good description") });
    Logger.logSuccess(simpleModel);
    verify(tree, atLeastOnce()).i(matches(".*\\b(List|count:|" + simpleModel.size() + ")\\b.*"));
}
Also used : SimpleModel(org.fossasia.openevent.app.data.models.dto.SimpleModel) List(java.util.List) Test(org.junit.Test)

Example 3 with SimpleModel

use of org.fossasia.openevent.app.data.models.dto.SimpleModel in project open-event-orga-app by fossasia.

the class DatabaseChangeListenerTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    databaseRepository.save(SimpleModel.class, DatabaseRepositoryTest.MODEL).subscribe();
    SimpleModel newModel = SimpleModel.fromModel(DatabaseRepositoryTest.MODEL);
    newModel.setDescription("Billy Bowden");
    databaseRepository.update(SimpleModel.class, newModel).subscribe();
    databaseChangeListener.stopListening();
    notifier.lastOrError().test().assertValue(value -> value.getAction().equals(BaseModel.Action.UPDATE) && value.getModel().equals(newModel));
}
Also used : SimpleModel(org.fossasia.openevent.app.data.models.dto.SimpleModel) Test(org.junit.Test)

Example 4 with SimpleModel

use of org.fossasia.openevent.app.data.models.dto.SimpleModel in project open-event-orga-app by fossasia.

the class DatabaseRepositoryTest method testUpdate.

@Test
public void testUpdate() {
    databaseRepository.save(SimpleModel.class, MODEL).subscribe();
    SimpleModel newModel = SimpleModel.fromModel(MODEL);
    newModel.setDescription("Melshi Jones");
    databaseRepository.update(SimpleModel.class, newModel).subscribe();
    databaseRepository.getItems(SimpleModel.class, SimpleModel_Table.id.eq(1L)).test().assertValue(simpleModel -> simpleModel.getDescription().equals("Melshi Jones"));
}
Also used : SimpleModel(org.fossasia.openevent.app.data.models.dto.SimpleModel) Test(org.junit.Test)

Aggregations

SimpleModel (org.fossasia.openevent.app.data.models.dto.SimpleModel)4 Test (org.junit.Test)4 List (java.util.List)1