method2testcases
stringlengths
118
6.63k
### Question: CaseInsensitiveString implements Comparable<CaseInsensitiveString> { @Override public boolean equals(final Object obj) { if (obj instanceof CaseInsensitiveString) { final CaseInsensitiveString other = (CaseInsensitiveString) obj; return name.equals(other.name); } return false; } CaseInsensitiveString(fina...
### Question: CaseInsensitiveString implements Comparable<CaseInsensitiveString> { @Override public int hashCode() { return name.hashCode(); } CaseInsensitiveString(final String name); @Override int compareTo(final CaseInsensitiveString other); @Override boolean equals(final Object obj); @Override int hashCode(); @Over...
### Question: CaseInsensitiveString implements Comparable<CaseInsensitiveString> { @Override public String toString() { return name.toString(); } CaseInsensitiveString(final String name); @Override int compareTo(final CaseInsensitiveString other); @Override boolean equals(final Object obj); @Override int hashCode(); @O...
### Question: XmiComparison { public XmiDefinition getLhsDef() { return lhsRef; } XmiComparison(final XmiDefinition lhsRef, final XmiDefinition rhsRef, final List<XmiMapping> mappings); XmiDefinition getLhsDef(); XmiDefinition getRhsDef(); List<XmiMapping> getMappings(); }### Answer: @Test public void testGetLhsDef() ...
### Question: XmiComparison { public XmiDefinition getRhsDef() { return rhsRef; } XmiComparison(final XmiDefinition lhsRef, final XmiDefinition rhsRef, final List<XmiMapping> mappings); XmiDefinition getLhsDef(); XmiDefinition getRhsDef(); List<XmiMapping> getMappings(); }### Answer: @Test public void testGetRhsDef() ...
### Question: XmiComparison { public List<XmiMapping> getMappings() { return mappings; } XmiComparison(final XmiDefinition lhsRef, final XmiDefinition rhsRef, final List<XmiMapping> mappings); XmiDefinition getLhsDef(); XmiDefinition getRhsDef(); List<XmiMapping> getMappings(); }### Answer: @Test public void testGetMa...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { @Override public int compareTo(final CaseInsensitiveQName other) { return QNameComparator.SINGLETON.compare(name, other.name); } CaseInsensitiveQName(final String type, final String feature); @Override int compareTo(final CaseInsensitiveQN...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { @Override public boolean equals(final Object obj) { if (obj instanceof CaseInsensitiveQName) { final CaseInsensitiveQName other = (CaseInsensitiveQName) obj; return name.equals(other.name); } return false; } CaseInsensitiveQName(final Stri...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { public String getLocalPart() { return name.getLocalPart(); } CaseInsensitiveQName(final String type, final String feature); @Override int compareTo(final CaseInsensitiveQName other); @Override boolean equals(final Object obj); String getLo...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { public String getNamespaceURI() { return name.getNamespaceURI(); } CaseInsensitiveQName(final String type, final String feature); @Override int compareTo(final CaseInsensitiveQName other); @Override boolean equals(final Object obj); String...
### Question: ResourceDocumenter { protected String readFile(File generatedHtml) { String content = ""; try { content = IOUtils.toString(new FileInputStream(generatedHtml)); } catch (FileNotFoundException e) { LOG.warn(e.getMessage()); } catch (IOException e) { LOG.warn(e.getMessage()); } return content; } void addRes...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { @Override public int hashCode() { return name.hashCode(); } CaseInsensitiveQName(final String type, final String feature); @Override int compareTo(final CaseInsensitiveQName other); @Override boolean equals(final Object obj); String getLoc...
### Question: CaseInsensitiveQName implements Comparable<CaseInsensitiveQName> { @Override public String toString() { return name.toString(); } CaseInsensitiveQName(final String type, final String feature); @Override int compareTo(final CaseInsensitiveQName other); @Override boolean equals(final Object obj); String get...
### Question: XmiMapping implements Comparable<XmiMapping> { @Override public int compareTo(final XmiMapping other) { return 0; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override...
### Question: XmiMapping implements Comparable<XmiMapping> { public XmiFeature getLhsFeature() { return lhs; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override boolean equals(Obj...
### Question: XmiMapping implements Comparable<XmiMapping> { public XmiFeature getRhsFeature() { return rhs; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override boolean equals(Obj...
### Question: XmiMapping implements Comparable<XmiMapping> { public XmiMappingStatus getStatus() { return status; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override boolean equal...
### Question: XmiMapping implements Comparable<XmiMapping> { public String getComment() { return comment; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override boolean equals(Object...
### Question: XmiMapping implements Comparable<XmiMapping> { public String getTracking() { return tracking; } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final String comment); @Override int compareTo(final XmiMapping other); @Override boolean equals(Obje...
### Question: XmiMapping implements Comparable<XmiMapping> { @Override public String toString() { return String.format("{lhs : %s, rhs : %s, status : %s, comment : %s}", lhs, rhs, status, comment); } XmiMapping(final XmiFeature lhs, final XmiFeature rhs, final XmiMappingStatus status, final String tracking, final Strin...
### Question: XmiFeature { public String getName() { return name; } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String getOwnerName(); boolean ownerExists(); boolean exists(); @Override String toString(); }### Answer: @Test public void testG...
### Question: ResourceDocumenter { protected String createLink(String key, String value) { String link = ""; link = LINK_HTML.replace("$LINK", baseUrl + value); link = link.replace("$TYPE", key); return link; } void addResourceMerge(File generatedHtml); static void main(String[] args); }### Answer: @Test public void ...
### Question: XmiFeature { public boolean exists() { return exists; } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String getOwnerName(); boolean ownerExists(); boolean exists(); @Override String toString(); }### Answer: @Test public void tes...
### Question: XmiFeature { public String getOwnerName() { return className; } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String getOwnerName(); boolean ownerExists(); boolean exists(); @Override String toString(); }### Answer: @Test public ...
### Question: XmiFeature { public boolean ownerExists() { return classExists; } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String getOwnerName(); boolean ownerExists(); boolean exists(); @Override String toString(); }### Answer: @Test publi...
### Question: XmiFeature { @Override public String toString() { return String.format("{name : %s, exists : %s, className : %s, classExists : %s}", name, exists, className, classExists); } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String get...
### Question: XmiDefinition { public String getName() { return name; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); }### Answer: @Test public void testGetName() { Assert.assertEquals(NAME, xmiDefinition.getName()); }
### Question: XmiDefinition { public String getVersion() { return version; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); }### Answer: @Test public void testGetVersion() { Assert.assertEquals(VERSION, xmiDefinition.getVersion()); }
### Question: XmiDefinition { public String getFile() { return file; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); }### Answer: @Test public void testGetFile() { Assert.assertEquals(FILE, xmiDefinition.getFile()); }
### Question: XmiReader { protected static final <T> T assertNotNull(final T obj) { if (obj != null) { return obj; } else { throw new AssertionError(); } } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName); }### A...
### Question: XmiReader { protected static final Occurs getOccurs(final XMLStreamReader reader, final XmiAttributeName name) { final int value = Integer.valueOf(reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName())); switch (value) { case 0: { return Occurs.ZERO; } case 1: { return Occurs.ONE; } case -1: { re...
### Question: DocumentManipulator { protected Document parseDocument(File file) throws DocumentManipulatorException { Document doc = null; try { DocumentBuilder builder = docFactory.newDocumentBuilder(); doc = builder.parse(file); } catch (SAXException e) { throw new DocumentManipulatorException(e); } catch (IOExceptio...
### Question: XmiReader { protected static final Identifier getIdRef(final XMLStreamReader reader) throws XmiMissingAttributeException { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.IDREF.getLocalName()); if (value != null) { return Identifier.fromString(value); } else { throw new Xm...
### Question: XmiReader { protected static final Identifier getId(final XMLStreamReader reader) { return Identifier.fromString(reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.ID.getLocalName())); } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static...
### Question: XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultVa...
### Question: XmiReader { protected static final void closeQuiet(final Closeable closeable) { IOUtils.closeQuietly(closeable); } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName); }### Answer: @Test public void te...
### Question: XmiReader { protected static final void assertName(final QName name, final XMLStreamReader reader) { if (!match(name, reader)) { throw new AssertionError(reader.getLocalName()); } } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model r...
### Question: XmiReader { protected static final void skipElement(final XMLStreamReader reader, final boolean check) throws XMLStreamException { if (check) { throw new AssertionError(reader.getName()); } final String localName = reader.getLocalName(); while (reader.hasNext()) { reader.next(); switch (reader.getEventTyp...
### Question: ValueMapper extends Mapper<TenantAndIdEmittableKey, BSONWritable, TenantAndIdEmittableKey, Writable> { @Override public void map(TenantAndIdEmittableKey key, BSONWritable entity, Context context) throws InterruptedException, IOException { context.write(key, getValue(entity)); } @Override void map(TenantA...
### Question: XmiReader { protected static final String getName(final XMLStreamReader reader, final String defaultName, final XmiAttributeName attr) { final String name = reader.getAttributeValue(GLOBAL_NAMESPACE, attr.getLocalName()); if (name != null) { return name; } else { return defaultName; } } static final Mode...
### Question: XmiWriter { public static final void writeDocument(final Model model, final ModelIndex mapper, final OutputStream outstream) { final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.wri...
### Question: WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (...
### Question: WadlHelper { public static List<Param> getRequestParams(final Method method) { if (method == null) { throw new IllegalArgumentException(); } final Request request = method.getRequest(); if (request != null) { return request.getParams(); } else { return Collections.emptyList(); } } private WadlHelper(); s...
### Question: DocumentManipulator { public NodeList getNodeList(Document doc, String expression) throws XPathException { XPath xpath = xPathFactory.newXPath(); xpath.setNamespaceContext(new DocumentNamespaceResolver(doc)); XPathExpression exp = xpath.compile(expression); Object result = exp.evaluate(doc, XPathConstants...
### Question: WadlHelper { public static final String computeId(final Method method, final Resource resource, final Resources resources, final Application app, final Stack<Resource> ancestors) { final List<String> steps = reverse(toSteps(resource, ancestors)); final StringBuilder sb = new StringBuilder(); sb.append(met...
### Question: WadlHelper { public static final String titleCase(final String text) { return text.substring(0, 1).toUpperCase().concat(text.substring(1)); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final R...
### Question: WadlHelper { public static final <T> List<T> reverse(final List<T> strings) { final LinkedList<T> result = new LinkedList<T>(); for (final T s : strings) { result.addFirst(s); } return Collections.unmodifiableList(result); } private WadlHelper(); static List<Param> getRequestParams(final Method method); ...
### Question: WadlHelper { public static final boolean isVersion(final String step) { return step.toLowerCase().equals("v1"); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final Resources resources, ...
### Question: WadlHelper { public static final String parseTemplateParam(final String step) { if (isTemplateParam(step)) { return step.substring(1, step.length() - 1); } else { throw new AssertionError(step); } } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String comput...
### Question: WadlHelper { public static final List<String> toSteps(final Resource resource, final Stack<Resource> ancestors) { final List<String> result = new LinkedList<String>(); for (final Resource ancestor : ancestors) { result.addAll(splitBasedOnFwdSlash(ancestor.getPath())); } result.addAll(splitBasedOnFwdSlash(...
### Question: WadlHelper { public static final boolean isTemplateParam(final String step) { return step.trim().startsWith("{") && step.endsWith("}"); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final Resou...
### Question: XsdReader { public static final XmlSchema readSchema(final String fileName, final URIResolver schemaResolver) throws FileNotFoundException { final InputStream istream = new BufferedInputStream(new FileInputStream(fileName)); try { return readSchema(istream, schemaResolver); } finally { closeQuiet(istream)...
### Question: SeaCustomDataProvider { public Map<String, List<SliEntityLocator>> getIdMap(String seaGuid) { LOG.info("Attempting to pull id map from SEA custom data, will cause exception if doesn't exist"); List<Entity> list = slcInterface.read("/educationOrganizations/" + seaGuid + "/custom"); if (list.size() > 0) { M...
### Question: ResourceDocumentation { public void addDocumentation() throws IOException, XPathException { final NodeList topLevelResources = manipulator.getNodeList(this.doc, " for (int i = 0; i < topLevelResources.getLength(); i++) { final Node node = topLevelResources.item(i); final ResourceEndPointTemplate resourceT...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public String getZoneSea(String zoneId) { synchronized (lock) { Map<String, SliEntityLocator> seaMap = zoneMapProvider.getZoneToSliIdMap(); SliEntityLocator locator = seaMap.get(zoneId); Entity seaEntity = fetchSliEntity(locator); if (seaEntity ...
### Question: DeltaExtractor implements InitializingBean { public void execute(String tenant, File tenantDirectory, DateTime deltaUptoTime) { TenantContext.setTenantId(tenant); audit(securityEventUtil.createSecurityEvent(this.getClass().getName(), "Delta Extract Initiation", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap....
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public Entity getSliEntityFromOtherSifId(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntity(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List<Strin...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public String getSliGuid(String sifId, String zoneId) { synchronized (lock) { Entity entity = getSliEntity(sifId, zoneId); if (entity == null) { LOG.info("No sli id found for sifId(" + sifId + ")"); return null; } return entity.getId(); } } @Ov...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public List<String> getSliGuidList(String sifId, String zoneId) { synchronized (lock) { List<Entity> entityList = getSliEntityList(sifId, zoneId); List<String> idList = new ArrayList<String>(); for (Entity entity : entityList) { idList.add(entit...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityListByType(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntityList(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public Entity getSliEntityByType(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntity(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSl...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public List<String> getSliGuidListByType(String sifId, String sliType, String zoneId) { synchronized (lock) { List<Entity> entityList = getSliEntityListByType(sifId, sliType, zoneId); List<String> idList = new ArrayList<String>(); for (Entity en...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public String getSliGuidByType(String sifId, String sliType, String zoneId) { synchronized (lock) { Entity entity = getSliEntityFromOtherSifId(sifId, sliType, zoneId); if (entity == null) { return null; } return entity.getId(); } } @Override St...
### Question: SifIdResolverCustomData implements SifIdResolver { @Override public void putSliGuidForOtherSifId(String sifId, String sliType, String sliId, String zoneId) { synchronized (lock) { String key = sifId + "-" + sliType; putSliGuid(key, sliType, sliId, zoneId); } } @Override String getSliGuid(String sifId, St...
### Question: AgentManager { public void setup() throws Exception { System.setProperty("adk.log.file", logPath + File.separator + adkLogFile); ADK.initialize(); ADK.debug = ADK.DBG_ALL; agent.startAgent(); subscribeToZone(); } @PostConstruct void postConstruct(); void setup(); @PreDestroy void cleanup(); void setSubsc...
### Question: AgentManager { @PreDestroy public void cleanup() throws ADKException { agent.shutdown(ADKFlags.PROV_NONE); } @PostConstruct void postConstruct(); void setup(); @PreDestroy void cleanup(); void setSubscribeTypeList(List<String> subscribeTypeList); List<String> getSubscribeTypeList(); void setSubscriberZon...
### Question: SifAgent extends Agent { public void startAgent() throws Exception { super.initialize(); setProperties(); Zone[] allZones = getZoneFactory().getAllZones(); zoneConfigurator.configure(allZones); } SifAgent(); SifAgent(String id); SifAgent(String id, ZoneConfigurator zoneConfig, Properties agentProperties...
### Question: StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeLis...
### Question: SifTranslationManager { public List<SliEntity> translate(SIFDataObject sifData, String zoneId) { List<SliEntity> entities = new ArrayList<SliEntity>(); List<TranslationTask> translationTasks = translationMap.get(sifData.getObjectType().toString()); if (translationTasks == null) { LOG.error("No Translation...
### Question: PublishZoneConfigurator implements ZoneConfigurator { @Override public void configure(Zone[] allZones) { for (Zone zone : allZones) { try { LOG.info("- Connecting to zone \"" + zone.getZoneId() + "\" at " + zone.getZoneUrl()); zone.connect(ADKFlags.PROV_REGISTER | ADKFlags.PROV_PROVIDE); } catch (ADKExcep...
### Question: SubscribeZoneConfigurator implements ZoneConfigurator { @Override public void configure(Zone[] allZones) { for (Zone zone : allZones) { try { LOG.info("- Connecting to zone \"" + zone.getZoneId() + "\" at " + zone.getZoneUrl()); zone.connect(ADKFlags.PROV_REGISTER | ADKFlags.PROV_SUBSCRIBE); } catch (ADKE...
### Question: SliEntity { public Map<String, Object> createBody() { Map<String, Object> body = null; try { body = MAPPER. readValue(this.json(), new TypeReference<Map<String, Object>>() { }); clearNullValueKeys(body); } catch (JsonParseException e) { LOG.error("Entity map conversion error: ", e); } catch (JsonMappingEx...
### Question: SliEntity { public GenericEntity createGenericEntity() { GenericEntity entity = new GenericEntity(entityType(), createBody()); return entity; } SliEntity(); abstract String entityType(); GenericEntity createGenericEntity(); Map<String, Object> createBody(); JsonNode json(); @JsonIgnore boolean isCreatedBy...
### Question: YesNoUnknownConverter { public Boolean convert(String value) { return value == null ? null : BOOLEAN_MAP.get(value); } Boolean convert(String value); }### Answer: @Test public void testNullObject() { Boolean result = converter.convert(null); Assert.assertNull("Race list should be null", result); } @Test...
### Question: YesNoConverter { public Boolean convert(YesNo value) { return value == null ? null : BOOLEAN_MAP.get(value); } Boolean convert(YesNo value); }### Answer: @Test public void testNullObject() { Boolean result = converter.convert(null); Assert.assertNull("Result should be null", result); } @Test public void...
### Question: EntityExtractor { public void extractEntities(ExtractFile archiveFile, String collectionName, Predicate<Entity> filter) { audit(securityEventUtil.createSecurityEvent(this.getClass().getName(), " Entity extraction", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0024, collectionName)); if (extractionQuer...
### Question: DateConverter { public String convert(Calendar date) { if (date == null) { return null; } return dateFormat.format(date.getTime()); } String convert(Calendar date); }### Answer: @Test public void shouldConvertWithCorrectFormat() { Calendar date = new GregorianCalendar(2004, Calendar.FEBRUARY, 29); Strin...
### Question: ElectronicIdListConverter { public List<StaffIdentificationCode> convert(ElectronicIdList electronicIdList) { if (electronicIdList == null) { return null; } return toSliStaffIdentificationCodeList(electronicIdList.getElectronicIds()); } List<StaffIdentificationCode> convert(ElectronicIdList electronicIdL...
### Question: SchoolFocusConverter { public String convert(SchoolFocusList schoolFocusList) { if (schoolFocusList == null || schoolFocusList.getSchoolFocuses().length == 0) { return null; } SchoolFocus[] schoolFocus = schoolFocusList.getSchoolFocuses(); String result = SCHOOL_FOCUS_MAP.get(schoolFocus[0].getValue()); i...
### Question: EntityExtractor { public void extractEntity(Entity entity, ExtractFile archiveFile, String collectionName, Predicate<Entity> filter) { if (archiveFile != null) { write(entity, archiveFile, new CollectionWrittenRecord(collectionName), filter); } } void extractEntities(ExtractFile archiveFile, String colle...
### Question: JobClassificationConverter { public String convert(JobClassification jobClassification) { if (jobClassification == null) { return null; } return toSliEntryType(JobClassificationCode.wrap(jobClassification.getCode())); } String convert(JobClassification jobClassification); }### Answer: @Test public void ...
### Question: EmailListConverter { public List<ElectronicMail> convert(EmailList list) { if (list == null) { return null; } List<ElectronicMail> result = new ArrayList<ElectronicMail>(); for (Email sifEmail : list) { ElectronicMail sliEmail = new ElectronicMail(); sliEmail.setEmailAddress(sifEmail.getValue()); result.a...
### Question: TreatmentApplicator implements Treatment { @Override public Entity apply(Entity entity) { Entity treated = entity; for (Treatment treatment : treatments) { treated = treatment.apply(treated); } return treated; } @Override Entity apply(Entity entity); List<Treatment> getTreatments(); void setTreatments(Li...
### Question: DemographicsToBirthDataConverter { public BirthData convert(Demographics sifDemographics) { if (sifDemographics == null) { return null; } BirthData sliBirthData = new BirthData(); sliBirthData.setCountryOfBirthCode(sifDemographics.getCountryOfBirth()); sliBirthData.setCityOfBirth(sifDemographics.getPlaceO...
### Question: EntryTypeConverter { public String convert(EntryType entryType) { if (entryType == null) { return null; } return toSliEntryType(EntryTypeCode.wrap(entryType.getCode())); } String convert(EntryType entryType); }### Answer: @Test public void testNullObject() { String result = converter.convert(null); Asse...
### Question: AddressListConverter { public List<Address> convert(AddressList addressList) { if (addressList == null) { return null; } return toSliAddressList(addressList.getAddresses()); } List<Address> convert(AddressList addressList); List<Address> convert(StudentAddressList addressList); }### Answer: @Test public...
### Question: AttendanceTreatment implements Treatment { @Override public Entity apply(Entity entity) { if (entity.getBody().containsKey("schoolYearAttendance")) { LOG.debug("Treatment has already been applied to attendance entity: {}", new Object[] { entity.getEntityId() }); return entity; } Map<String,Object> treated...
### Question: PhoneNumberListConverter { public List<InstitutionTelephone> convertInstitutionTelephone(PhoneNumberList phoneNumberList) { if (phoneNumberList == null) { return null; } return toSliInstitutionTelephoneList(phoneNumberList.getPhoneNumbers()); } List<InstitutionTelephone> convertInstitutionTelephone(Phone...
### Question: RaceListConverter { public List<String> convert(RaceList raceList) { if (raceList == null) { return null; } return toSliRaceList(raceList.getRaces()); } List<String> convert(RaceList raceList); }### Answer: @Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assert...
### Question: GradeLevelsConverter { public List<String> convert(GradeLevels source) { if (source == null) { return null; } return toSliGradeList(source.getGradeLevels()); } List<String> convert(GradeLevels source); String convert(GradeLevel source); }### Answer: @Test public void testNullObject() { List<String> resu...
### Question: OtherNamesConverter { public List<OtherName> convert(OtherNames sifOtherNames) { if (sifOtherNames == null) { return null; } List<OtherName> sliNames = new ArrayList<OtherName>(); for (openadk.library.common.Name sifName : sifOtherNames) { OtherName sliName = new OtherName(); nameConverter.mapSifNameIntoS...
### Question: EnglishProficiencyConverter { public String convert(EnglishProficiency ep) { if (ep == null) { return null; } EnglishProficiencyCode code = EnglishProficiencyCode.wrap(ep.getCode()); return ENGLISH_PROFICIENCY_MAP.get(code); } String convert(EnglishProficiency ep); }### Answer: @Test public void testNul...
### Question: SimpleExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { String entityDate = EntityDateHelper.retrieveDate(entity); return EntityDateHelper.isPastOrCurrentDate(entityDate, upToDate, entity.getType()); } @Override boolean shouldExtract(E...
### Question: SchoolYearConverter { public String convert(Integer schoolYear) { if (schoolYear == null) { return null; } Integer priorSchoolYear = schoolYear - 1; return priorSchoolYear.toString() + "-" + schoolYear.toString(); } String convert(Integer schoolYear); }### Answer: @Test public void testNullList() { Stri...
### Question: NameConverter { public Name convert(openadk.library.common.Name sifName) { if (sifName == null) { return null; } Name sliName = new Name(); mapSifNameIntoSliName(sifName, sliName); return sliName; } Name convert(openadk.library.common.Name sifName); void mapSifNameIntoSliName(openadk.library.common.Name ...
### Question: GenderConverter { public String convert(String gender) { return GENDER_TYPE_MAP.get(gender); } String convert(String gender); }### Answer: @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Race list should be null", result); } @Test public void testMale() {...
### Question: OperationalStatusConverter { public String convert(OperationalStatus operationalStatus) { if (operationalStatus == null || operationalStatus.getValue() == null || operationalStatus.getValue().isEmpty()) { return null; } return OPERATIONAL_STATUS_MAP.get(operationalStatus); } String convert(OperationalSta...
### Question: SchoolLevelTypeConverter { public String convert(SchoolLevelType schoolLevelType) { if (schoolLevelType == null) { return null; } return SCHOOL_LEVEL_TYPE_MAP.get(schoolLevelType); } String convert(SchoolLevelType schoolLevelType); List<String> convertAsList(SchoolLevelType schoolLevelType); }### Answer...
### Question: SchoolLevelTypeConverter { public List<String> convertAsList(SchoolLevelType schoolLevelType) { if (schoolLevelType == null) { return null; } ArrayList<String> list = new ArrayList<String>(); String category = SCHOOL_LEVEL_TYPE_MAP.get(schoolLevelType); if (category != null) { list.add(category); } return...