### Question:
SubscriptionResource extends AbstractResource { @GET public VirtualMachinesDto getSubscriptions( @QueryParam(VIRTUAL_MACHINE_NAME_QUERY_PARAM) String virtualMachineName) { checkSystem(); Set<VirtualMachine> vms = null; if (virtualMachineName == null) { vms = dao.findAllVirtualMachines(); } else { virtualMachineName = decodeParameter(virtualMachineName); VirtualMachine vm = dao.findVirtualMachineByName(virtualMachineName); if (vm == null) { throw new VSMException(Status.NOT_FOUND, "There is no subscription for virtual machine " + virtualMachineName); } vms = new HashSet<VirtualMachine>(); vms.add(vm); } VirtualMachinesDto dto = new VirtualMachinesDto(); for (VirtualMachine vm : vms) { dto.add(toDto(vm)); } return dto; } SubscriptionResource(); @GET VirtualMachinesDto getSubscriptions(
        @QueryParam(VIRTUAL_MACHINE_NAME_QUERY_PARAM) String virtualMachineName); @POST VirtualMachineDto subscribe(VirtualMachineDto virtualMachine); @DELETE @Path(SUBSCRIPTION_PATH) void unsubscribe(@PathParam(SUBSCRIPTION_PARAM) String subscriptionId); static final String SUBSCRIPTIONS_PATH; static final String SUBSCRIPTION_PARAM; static final String SUBSCRIPTION_PATH; }### Answer:
@Test public void test_getSubscriptionUnexisting() { try { subsResource.getSubscriptions("vm-to-find"); fail("Subscription for virtual machine 'vm-to-find' should not exist"); } catch (VSMException ex) { assertEquals(ex.getResponse().getStatus(), Status.NOT_FOUND.getStatusCode()); } }