### Question:
ProfileUtil { public static Profile findProfile(String profileArg, File resourceDir) throws IOException { try { String profile = profileArg == null ? DEFAULT_PROFILE : profileArg; Profile profileFound = lookup(profile, resourceDir); if (profileFound != null) { if(profileFound.getParentProfile() != null) { profileFound = inheritFromParentProfile(profileFound, resourceDir); log.info(profileFound + " inheriting resources from " + profileFound.getParentProfile()); } return profileFound; } else { throw new IllegalArgumentException("No profile '" + profile + "' defined"); } } catch (IOException e) { throw new IOException("Error while looking up profile " + profileArg + ": " + e.getMessage(),e); } } private  ProfileUtil(); static Profile findProfile(String profileArg, File resourceDir); static ProcessorConfig blendProfileWithConfiguration(ProcessorConfigurationExtractor configExtractor,
                                                                String profile,
                                                                File resourceDir,
                                                                ProcessorConfig config); static Profile lookup(String name, File directory); static List<Profile> readAllFromClasspath(String name, String ext); static List<Profile> fromYaml(InputStream is); static final String[] PROFILE_FILENAMES; static final String DEFAULT_PROFILE; final static ProcessorConfigurationExtractor GENERATOR_CONFIG; final static ProcessorConfigurationExtractor ENRICHER_CONFIG; final static ProcessorConfigurationExtractor WATCHER_CONFIG; }### Answer:
@Test public void shouldExtend() throws Exception { Profile aProfile = ProfileUtil.findProfile("minimal", getProfileDir()); assertEquals("minimal", aProfile.getName()); assertEquals("simple", aProfile.getParentProfile()); assertTrue(aProfile.getEnricherConfig().use("jshift-name")); assertTrue(aProfile.getEnricherConfig().use("default.service")); assertTrue(aProfile.getGeneratorConfig().use("spring.swarm")); assertFalse(aProfile.getGeneratorConfig().use("java.app")); }
@Test public void findProfile() throws URISyntaxException, IOException { assertNotNull(ProfileUtil.findProfile("simple", getProfileDir())); try { ProfileUtil.findProfile("not-there", getProfileDir()); fail(); } catch (IllegalArgumentException exp) { assertTrue(exp.getMessage().contains("not-there")); } }
@Test public void shouldExtend() throws Exception { Profile aProfile = ProfileUtil.findProfile("minimal", getProfileDir()); assertEquals("minimal", aProfile.getName()); assertEquals("simple", aProfile.getParentProfile()); assertTrue(aProfile.getEnricherConfig().use("fmp-name")); assertTrue(aProfile.getEnricherConfig().use("default.service")); assertTrue(aProfile.getGeneratorConfig().use("spring.swarm")); assertFalse(aProfile.getGeneratorConfig().use("java.app")); }