@Test public void testNotNull() throws SifTranslationException { List<StudentSchoolAssociationEntity> result = translator.translate(new StudentLEARelationship(), null); Assert.assertNotNull("Result was null", result); Assert.assertEquals(1, result.size()); }
@Test public void testGradeLevel() throws SifTranslationException { StudentLEARelationship slr = new StudentLEARelationship(); GradeLevel gradeLevel = new GradeLevel(GradeLevelCode._10); slr.setGradeLevel(gradeLevel); Mockito.when(gradeLevelsConverter.convert(gradeLevel)).thenReturn("Tenth grade"); List<StudentSchoolAssociationEntity> result = translator.translate(slr, null); Assert.assertEquals(1, result.size()); StudentSchoolAssociationEntity entity = result.get(0); Assert.assertEquals( "entry grade level is expected to be 'Tenth grade'", "Tenth grade", entity.getEntryGradeLevel()); }
@Test public void testExitType() throws SifTranslationException { StudentLEARelationship slr = new StudentLEARelationship(); ExitType exitType = new ExitType(ExitTypeCode._1923_DIED_OR_INCAPACITATED); slr.setExitType(exitType); Mockito.when(exitTypeConverter.convert(exitType)) .thenReturn("Died or is permanently incapacitated"); List<StudentSchoolAssociationEntity> result = translator.translate(slr, null); Assert.assertEquals(1, result.size()); StudentSchoolAssociationEntity entity = result.get(0); Assert.assertEquals( "exit withdraw type is expected to be 'Died or is permanently incapacitated'", "Died or is permanently incapacitated", entity.getExitWithdrawType()); }
@Test public void testEntryType() throws SifTranslationException { StudentLEARelationship slr = new StudentLEARelationship(); EntryType entryType = new EntryType(EntryTypeCode._0619_1832); slr.setEntryType(entryType); Mockito.when(entryTypeConverter.convert(entryType)) .thenReturn("Transfer from a charter school"); List<StudentSchoolAssociationEntity> result = translator.translate(slr, null); Assert.assertEquals(1, result.size()); StudentSchoolAssociationEntity entity = result.get(0); Assert.assertEquals( "entry type is expected to be 'Transfer from a charter school'", "Transfer from a charter school", entity.getEntryType()); }
@Test public void testDates() throws SifTranslationException { StudentLEARelationship slr = new StudentLEARelationship(); Calendar hire = new GregorianCalendar(2004, Calendar.FEBRUARY, 1); Calendar terminate = new GregorianCalendar(2005, Calendar.DECEMBER, 29); slr.setEntryDate(hire); slr.setExitDate(terminate); Mockito.when(dateConverter.convert(hire)).thenReturn("hireDate"); Mockito.when(dateConverter.convert(terminate)).thenReturn("terminateDate"); List<StudentSchoolAssociationEntity> result = translator.translate(slr, null); Assert.assertEquals(1, result.size()); StudentSchoolAssociationEntity entity = result.get(0); Assert.assertEquals("hireDate", entity.getEntryDate()); Assert.assertEquals("terminateDate", entity.getExitWithdrawDate()); }
@Test public void testBasicFields() throws SifTranslationException { StudentLEARelationship slr = new StudentLEARelationship(); slr.setStudentPersonalRefId("studentRefID"); slr.setLEAInfoRefId("LEAInfoRefID"); slr.setSchoolYear(Integer.valueOf(2001)); Mockito.when(mockSifIdResolver.getSliGuid("studentRefID", null)).thenReturn("SLI_StudentGUID"); Mockito.when(mockSifIdResolver.getSliGuid("LEAInfoRefID", null)).thenReturn("SLI_SchoolGUID"); Mockito.when(schoolYearConverter.convert(Integer.valueOf(2001))).thenReturn("2001"); List<StudentSchoolAssociationEntity> result = translator.translate(slr, null); Assert.assertEquals(1, result.size()); StudentSchoolAssociationEntity entity = result.get(0); Assert.assertEquals( "student Id is expected to be 'SLI_StudentGUID'", "SLI_StudentGUID", entity.getStudentId()); Assert.assertEquals( "school Id is expected to be 'SLI_SchoolGUID'", "SLI_SchoolGUID", entity.getSchoolId()); Assert.assertEquals("school yewar is expected to be '2001'", "2001", entity.getSchoolYear()); }