### Question:
ResourceProfile extends BaseProfile<ResourceProfile, ResourceProvider> { @Deprecated public static Collection<? extends ResourceProfile> loadFrom(Properties properties, ClassLoader loader) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } if (loader == null) { throw new IllegalArgumentException("loader must not be null"); } return loadFrom(properties, ProfileContext.system(loader)); } ResourceProfile(
            String name,
            Class<? extends ResourceProvider> providerClass,
            ProfileContext context,
            Map<String, String> configuration); String getName(); @Override Class<? extends ResourceProvider> getProviderClass(); @Override ProfileContext getContext(); Map<String, String> getConfiguration(); @Deprecated static Collection<? extends ResourceProfile> loadFrom(Properties properties, ClassLoader loader); static Collection<? extends ResourceProfile> loadFrom(Properties properties, ProfileContext context); void storeTo(Properties properties); static void removeCorrespondingKeys(Properties properties); static final Pattern NAME_PATTERN; static final String KEY_PREFIX; }### Answer:
@Test public void loadFrom() { Properties p = new Properties(); p.setProperty(ResourceProfile.KEY_PREFIX + "testing", MockResourceProvider.class.getName()); Collection<? extends ResourceProfile> profiles = ResourceProfile.loadFrom(p, ProfileContext.system(getClass().getClassLoader())); assertThat(profiles.size(), is(1)); ResourceProfile r1 = find(profiles, "testing"); assertThat(r1.getName(), is("testing")); assertThat(r1.getProviderClass(), is((Object) MockResourceProvider.class)); assertThat(r1.getConfiguration().size(), is(0)); }
@Test(expected = IllegalArgumentException.class) public void loadFrom_invalid_provider() { Properties p = new Properties(); p.setProperty(ResourceProfile.KEY_PREFIX + "invalid", "INVALID-CLASS-NAME"); ResourceProfile.loadFrom(p, ProfileContext.system(getClass().getClassLoader())); }
@Test(expected = IllegalArgumentException.class) public void loadFrom_missing_provider() { Properties p = new Properties(); p.setProperty(ResourceProfile.KEY_PREFIX + "testing" + BaseProfile.QUALIFIER + "aaa", "aaa"); p.setProperty(ResourceProfile.KEY_PREFIX + "testing" + BaseProfile.QUALIFIER + "bbb", "bbb"); ResourceProfile.loadFrom(p, ProfileContext.system(getClass().getClassLoader())); }