### Question:
AggregatingMachineProvisioningLocation extends AbstractLocation implements MachineProvisioningLocation<T>, Closeable { @Override public void release(T machine) { MachineProvisioningLocation<T> provisioner = inUse.remove(machine); if (provisioner != null) { provisioner.release(machine); } else { throw new IllegalStateException("Request to release machine "+machine+", but this machine is not currently allocated"); } } AggregatingMachineProvisioningLocation();  AggregatingMachineProvisioningLocation(Map properties); @Override void init(); @Override String toVerboseString(); @Override AbstractLocation configure(Map<?,?> properties); @Override AggregatingMachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags); @Override void close(); T obtain(); @Override T obtain(Map<?,?> flags); @Override void release(T machine); @Override Map<String,Object> getProvisioningFlags(Collection<String> tags);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testReleaseWhenNotHeldThrows() throws Exception { aggregator = newLocation(AggregatingMachineProvisioningLocation.class, ImmutableMap.of("provisioners", ImmutableList.of(provisioner1, provisioner2))); try { aggregator.release(machine1a); fail(); } catch (IllegalStateException e) { if (!e.toString().contains("machine is not currently allocated")) throw e; } }