ProfileDirectoryImpl implements ProfileDirectory { @Override public ValidationProfile getValidationProfileById(String profileID) { if (profileID == null) throw new IllegalArgumentException( "Parameter profileID cannot be null"); PDFAFlavour flavour = this.flavourDir.getItem(profileID); if (flavour == null) throw new NoSuchElementException("PDFAFlavour " + flavour + " is not supported by this directory."); return this.getValidationProfileByFlavour(flavour); } private  ProfileDirectoryImpl(Set<ValidationProfile> profileSet); private  ProfileDirectoryImpl(Map<PDFAFlavour, ValidationProfile> profileMap); @Override Set<String> getValidationProfileIds(); @Override Set<PDFAFlavour> getPDFAFlavours(); @Override ValidationProfile getValidationProfileById(String profileID); @Override ValidationProfile getValidationProfileByFlavour(PDFAFlavour flavour); @Override Set<ValidationProfile> getValidationProfiles();  }
@Test public final void testGetValidationProfileById() { ProfileDirectory dir = Profiles.directoryFromProfiles(DEFAULT_ALONE); assertTrue(dir.getValidationProfileById( DEFAULT.getPDFAFlavour().getId()).getPDFAFlavour() == PDFAFlavour.NO_FLAVOUR); dir = Profiles.directoryFromProfiles(PDFA_1B_ALONE); assertTrue(dir.getValidationProfileById( PDFA_1B.getPDFAFlavour().getId()).getPDFAFlavour() == PDFAFlavour.PDFA_1_B); dir = Profiles.directoryFromProfiles(DUAL_PROFILE); assertTrue(dir.getValidationProfileById( DEFAULT.getPDFAFlavour().getId()).getPDFAFlavour() == PDFAFlavour.NO_FLAVOUR); assertTrue(dir.getValidationProfileById( PDFA_1B.getPDFAFlavour().getId()).getPDFAFlavour() == PDFAFlavour.PDFA_1_B); }
@Test(expected = NoSuchElementException.class) public final void testGetValidationProfileByIdNoElement() { ProfileDirectory dir = Profiles.directoryFromProfiles(DEFAULT_ALONE); dir.getValidationProfileById(PDFAFlavour.PDFA_2_A.getId()); }