Search in sources :

Example 1 with NumberLearningEvent

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

the class NumberLearningEventDaoTest method testReadAllByApplication.

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

Example 2 with NumberLearningEvent

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

the class NumberLearningEventDaoTest method testReadAllByDevice.

@Test
public void testReadAllByDevice() {
    Device device = new Device();
    device.setDeviceId("576de45ad9e0b07cf66");
    deviceDao.create(device);
    List<NumberLearningEvent> numberLearningEvents = numberLearningEventDao.readAll(device);
    assertThat(numberLearningEvents.size(), is(0));
    Number number = new Number();
    number.setValue(1);
    numberDao.create(number);
    NumberLearningEvent numberLearningEvent = new NumberLearningEvent();
    numberLearningEvent.setDevice(device);
    numberLearningEvent.setNumber(number);
    numberLearningEventDao.create(numberLearningEvent);
    numberLearningEvents = numberLearningEventDao.readAll(device);
    assertThat(numberLearningEvents.size(), is(1));
    assertThat(numberLearningEvents.get(0).getNumber().getValue(), is(1));
}
Also used : Number(ai.elimu.model.content.Number) Device(ai.elimu.model.Device) NumberLearningEvent(ai.elimu.model.analytics.NumberLearningEvent) Test(org.junit.Test)

Example 3 with NumberLearningEvent

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

the class NumberLearningEventDaoTest method testReadAllByStudent.

@Test
public void testReadAllByStudent() {
    Student student = new Student();
    student.setUniqueId("576de45ad9e0b07cf66_1");
    studentDao.create(student);
    List<NumberLearningEvent> numberLearningEvents = numberLearningEventDao.readAll(student);
    assertThat(numberLearningEvents.size(), is(0));
    NumberLearningEvent numberLearningEvent = new NumberLearningEvent();
    numberLearningEvent.setStudent(student);
    numberLearningEventDao.create(numberLearningEvent);
    numberLearningEvents = numberLearningEventDao.readAll(student);
    assertThat(numberLearningEvents.size(), is(1));
    assertThat(numberLearningEvents.get(0).getStudent().getUniqueId(), is("576de45ad9e0b07cf66_1"));
}
Also used : NumberLearningEvent(ai.elimu.model.analytics.NumberLearningEvent) Student(ai.elimu.model.Student) Test(org.junit.Test)

Aggregations

NumberLearningEvent (ai.elimu.model.analytics.NumberLearningEvent)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 Number (ai.elimu.model.content.Number)1