### Question:
PreferredVolumeChooser extends RandomVolumeChooser { private static final String getCustomPropertySuffix(ChooserScope scope) { return "volume.preferred." + scope.name().toLowerCase(); }  @Override String choose(VolumeChooserEnvironment env, Set<String> options); @Override Set<String> choosable(VolumeChooserEnvironment env, Set<String> options);  }### Answer:
@Test public void testTableScopeUsingDefaultScopeProperty() { expect(tableConf.getTableCustom(TABLE_CUSTOM_SUFFIX)).andReturn(null).once(); expect(systemConf.getCustom(getCustomPropertySuffix(ChooserScope.DEFAULT))).andReturn("3,2") .once(); replay(serviceEnv, tableConf, systemConf); assertEquals(Set.of("2", "3"), chooseForTable()); }
@Test public void testTableScopeWithNoConfig() { expect(tableConf.getTableCustom(TABLE_CUSTOM_SUFFIX)).andReturn(null).once(); expect(systemConf.getCustom(getCustomPropertySuffix(ChooserScope.DEFAULT))).andReturn(null) .once(); replay(serviceEnv, tableConf, systemConf); assertThrows(VolumeChooserException.class, this::chooseForTable); }
@Test public void testTableScopeWithUnrecognizedVolumes() { expect(tableConf.getTableCustom(TABLE_CUSTOM_SUFFIX)).andReturn(null).once(); expect(systemConf.getCustom(getCustomPropertySuffix(ChooserScope.DEFAULT))).andReturn("4") .once(); replay(serviceEnv, tableConf, systemConf); assertThrows(VolumeChooserException.class, this::chooseForTable); }