@Test public void testshouldExtractTeacherSchoolAssociation() { Entity mSeoa = Mockito.mock(Entity.class); Map<String, Object> body = new HashMap<String, Object>(); body.put(ParameterConstants.BEGIN_DATE, "2009-09-02"); body.put(ParameterConstants.END_DATE, "2010-05-31"); Mockito.when(mSeoa.getBody()).thenReturn(body); Mockito.when(mSeoa.getType()).thenReturn(EntityNames.STAFF_ED_ORG_ASSOCIATION); Mockito.when(edOrgExtractHelper.retrieveSEOAS(Matchers.eq("Staff1"), Matchers.eq("LEA"))).thenReturn(Arrays.asList(mSeoa)); Map<String, Object> tsaBody = new HashMap<String, Object>(); tsaBody.put(ParameterConstants.TEACHER_ID, "Staff1"); tsaBody.put(ParameterConstants.SCHOOL_ID, "LEA"); Entity tsa = Mockito.mock(Entity.class); Mockito.when(tsa.getBody()).thenReturn(tsaBody); Mockito.when(tsa.getType()).thenReturn(EntityNames.TEACHER_SCHOOL_ASSOCIATION); Assert.assertTrue(tsaev.shouldExtract(tsa, DateTime.parse("2011-05-23", DateHelper.getDateTimeFormat()))); Assert.assertTrue(tsaev.shouldExtract(tsa, DateTime.parse("2009-09-02", DateHelper.getDateTimeFormat()))); Assert.assertTrue(tsaev.shouldExtract(tsa, null)); Assert.assertFalse(tsaev.shouldExtract(tsa, DateTime.parse("2009-09-01", DateHelper.getDateTimeFormat()))); Assert.assertFalse(tsaev.shouldExtract(tsa, DateTime.parse("2008-05-24", DateHelper.getDateTimeFormat()))); }
@Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_ID)); return shouldExtract(seaos, upToDate); }
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_ID)); return shouldExtract(seaos, upToDate); } }
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_ID)); return shouldExtract(seaos, upToDate); }  }
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_ID)); return shouldExtract(seaos, upToDate); }  @Override boolean shouldExtract(Entity entity, DateTime upToDate); }
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_ID)); return shouldExtract(seaos, upToDate); }  @Override boolean shouldExtract(Entity entity, DateTime upToDate);  }