Search in sources :

Example 1 with LetterLearningEvent

use of ai.elimu.model.analytics.LetterLearningEvent in project webapp by elimu-ai.

the class LetterLearningEventDaoTest method testReadAllByStudent.

@Test
public void testReadAllByStudent() {
    Student student = new Student();
    student.setUniqueId("ddhe72a08347cd29bd3f43d_1");
    studentDao.create(student);
    List<LetterLearningEvent> letterLearningEvents = letterLearningEventDao.readAll(student);
    assertThat(letterLearningEvents.size(), is(0));
    LetterLearningEvent letterLearningEvent = new LetterLearningEvent();
    letterLearningEvent.setStudent(student);
    letterLearningEventDao.create(letterLearningEvent);
    letterLearningEvents = letterLearningEventDao.readAll(student);
    assertThat(letterLearningEvents.size(), is(1));
    assertThat(letterLearningEvents.get(0).getStudent().getUniqueId(), is("ddhe72a08347cd29bd3f43d_1"));
}
Also used : Student(ai.elimu.model.Student) LetterLearningEvent(ai.elimu.model.analytics.LetterLearningEvent) Test(org.junit.Test)

Example 2 with LetterLearningEvent

use of ai.elimu.model.analytics.LetterLearningEvent in project webapp by elimu-ai.

the class LetterLearningEventDaoTest method testReadAllByApplication.

@Test
public void testReadAllByApplication() {
    Application application = new Application();
    application.setPackageName("ai.elimu.handwriting");
    applicationDao.create(application);
    List<LetterLearningEvent> letterLearningEvents = letterLearningEventDao.readAll(application);
    assertThat(letterLearningEvents.size(), is(0));
    LetterLearningEvent letterLearningEvent = new LetterLearningEvent();
    letterLearningEvent.setApplication(application);
    letterLearningEventDao.create(letterLearningEvent);
    letterLearningEvents = letterLearningEventDao.readAll(application);
    assertThat(letterLearningEvents.size(), is(1));
    assertThat(letterLearningEvents.get(0).getApplication().getPackageName(), is("ai.elimu.handwriting"));
}
Also used : Application(ai.elimu.model.admin.Application) LetterLearningEvent(ai.elimu.model.analytics.LetterLearningEvent) Test(org.junit.Test)

Example 3 with LetterLearningEvent

use of ai.elimu.model.analytics.LetterLearningEvent in project webapp by elimu-ai.

the class LetterLearningEventDaoTest method testReadAllByDevice.

@Test
public void testReadAllByDevice() {
    Device device = new Device();
    device.setDeviceId("ddhe72a08347cd29bd3f43d");
    deviceDao.create(device);
    List<LetterLearningEvent> letterLearningEvents = letterLearningEventDao.readAll(device);
    assertThat(letterLearningEvents.size(), is(0));
    Letter letter = new Letter();
    letter.setText("a");
    letterDao.create(letter);
    LetterLearningEvent letterLearningEvent = new LetterLearningEvent();
    letterLearningEvent.setDevice(device);
    letterLearningEvent.setLetter(letter);
    letterLearningEventDao.create(letterLearningEvent);
    letterLearningEvents = letterLearningEventDao.readAll(device);
    assertThat(letterLearningEvents.size(), is(1));
    assertThat(letterLearningEvents.get(0).getLetter().getText(), is("a"));
}
Also used : Letter(ai.elimu.model.content.Letter) Device(ai.elimu.model.Device) LetterLearningEvent(ai.elimu.model.analytics.LetterLearningEvent) Test(org.junit.Test)

Aggregations

LetterLearningEvent (ai.elimu.model.analytics.LetterLearningEvent)3 Test (org.junit.Test)3 Device (ai.elimu.model.Device)1 Student (ai.elimu.model.Student)1 Application (ai.elimu.model.admin.Application)1 Letter (ai.elimu.model.content.Letter)1