### Question:
PropertyExtensionPackageProvider implements ExtensionPackageProvider { @Override public Set<String> getPackageNames(ConfigurableEnvironment env) { @SuppressWarnings("unchecked") Set<String> packageNames = env.getProperty("extension-packages", Set.class); return packageNames == null ? Collections.<String>emptySet() : packageNames; }  @Override Set<String> getPackageNames(ConfigurableEnvironment env);  }### Answer:
@Test public void noPackagesDeclared() { when(env.getProperty("extension-packages", Set.class)).thenReturn(ImmutableSet.of()); Set<String> packages = underTest.getPackageNames(env); assertThat(packages.size(), is(0)); }
@Test public void twoPackagesDeclared() { when(env.getProperty("extension-packages", Set.class)).thenReturn(ImmutableSet.of("com.foo", "com.bar")); Set<String> packages = underTest.getPackageNames(env); assertThat(packages.size(), is(2)); Iterator<String> iterator = packages.iterator(); assertThat(iterator.next(), is("com.foo")); assertThat(iterator.next(), is("com.bar")); }