Untitled
unknown
plain_text
2 years ago
1.3 kB
4
Indexable
package TODO @DataJpaTest class TeacherDashboardTest extends SpockTest { def teacher def setup() { createExternalCourseAndExecution() teacher = new Teacher(USER_1_NAME, false) userRepository.save(teacher) } def createTeacherDashboardAndPersist() { def teacherDashboard = new TeacherDashboard(externalCourseExecution, teacher) teacherDashboardRepository.save(teacherDashboard) return teacherDashboard } def "create an empty dashboard"() { when: "a new teacher dashboard is created" def teacherDashboard = createTeacherDashboardAndPersist() then: "the new teacher dashboard is correctly persisted" teacherDashboardRepository.count() == 1L def result = teacherDashboardRepository.findAll().get(0) result.getId() != 0 result.getCourseExecution().getId() == externalCourseExecution.getId() result.getTeacher().getId() == teacher.getId() and: "the teacher has a reference for the dashboard" teacher.getDashboards().size() == 1 teacher.getDashboards().contains(result) } @TestConfiguration static class LocalBeanConfiguration extends BeanConfiguration {} }
Editor is loading...