### Question:
DefaultSelectorStore implements SelectorRepository { @Override public SemanticSelector getSelector(String type) { return defaultSelectors.containsKey(type) ? defaultSelectors.get(type) : getFallBackSelector(type); }  @Override SemanticSelector getSelector(String type); static final String DEFAULT_SELECTOR_TYPE_KEY; static final String DEFAULT_SELECTOR_VALUE_KEY; static final String DEFAULT_SELECTOR_RESOURCE_FILENAME; static final Map<String, Object> FALLBACK_SELECTOR; }### Answer:
@Test public void testSuccessfulLoadOfData() { final ClassType studentType = provider.getClassType("Student"); final ClassType studentSectionAssociationType = provider.getClassType("StudentSectionAssociation"); final ClassType sectionType = provider.getClassType("Section"); SemanticSelector sectionSelector = defaultSelectorRepository.getSelector("Section"); assertNotNull("Should not be null", sectionSelector); List<SelectorElement> elements = sectionSelector.get(sectionType); SelectorElement element = elements.get(0); assertTrue("Should be true", element instanceof BooleanSelectorElement); assertEquals("Should match", "sequenceOfCourse", element.getElementName()); SemanticSelector studentSelector = defaultSelectorRepository.getSelector("Student"); assertNotNull("Should not be null", studentSelector); elements = studentSelector.get(studentType); for (SelectorElement e : elements) { if (e instanceof IncludeXSDSelectorElement) { assertEquals("Should match", studentType, e.getLHS()); } else if (e instanceof BooleanSelectorElement) { assertEquals("Should match", studentSectionAssociationType, e.getLHS()); } else { fail("unknown type"); } } SemanticSelector studentSectionAssociationSelector = defaultSelectorRepository.getSelector("StudentSectionAssociation"); assertNotNull("Should not be null", studentSectionAssociationSelector); elements = studentSectionAssociationSelector.get(studentSectionAssociationType); element = elements.get(0); assertTrue("Should be true", element instanceof IncludeXSDSelectorElement); }
@Test public void assertGracefulHandlingOfInvalidTypeDefaultSelector() { assertNull("Should be null", defaultSelectorRepository.getSelector("type1")); }
@Test public void assertGracefulHandlingOfMissingDefaultSelector() { final ClassType schoolType = provider.getClassType("School"); SemanticSelector schoolSelector = defaultSelectorRepository.getSelector("School"); assertNotNull("Should not be null", schoolSelector); List<SelectorElement> elements = schoolSelector.get(schoolType); assertEquals("Should match", 1, elements.size()); SelectorElement element = elements.get(0); assertTrue("Should be true", element instanceof IncludeXSDSelectorElement); }