SlotStatus { public static SlotStatus createSlotStatus(UUID id, URI self, URI externalUri, String instanceId, String location, SlotLifecycleState state, Assignment assignment, String installPath, Map<String, Integer> resources) { return new SlotStatus(id, self, externalUri, instanceId, location, state, assignment, installPath, resources, null, null, null); } private  SlotStatus(UUID id,
            URI self,
            URI externalUri,
            String instanceId, String location,
            SlotLifecycleState state,
            Assignment assignment,
            String installPath,
            Map<String, Integer> resources,
            SlotLifecycleState expectedState,
            Assignment expectedAssignment,
            String statusMessage); static SlotStatus createSlotStatus(UUID id,
            URI self,
            URI externalUri,
            String instanceId,
            String location,
            SlotLifecycleState state,
            Assignment assignment,
            String installPath,
            Map<String, Integer> resources); static SlotStatus createSlotStatusWithExpectedState(UUID id,
            URI self,
            URI externalUri,
            String instanceId,
            String location,
            SlotLifecycleState state,
            Assignment assignment,
            String installPath,
            Map<String, Integer> resources,
            SlotLifecycleState expectedState,
            Assignment expectedAssignment,
            String statusMessage); UUID getId(); URI getSelf(); URI getExternalUri(); String getInstanceId(); String getLocation(); Assignment getAssignment(); SlotLifecycleState getState(); String getVersion(); SlotLifecycleState getExpectedState(); Assignment getExpectedAssignment(); String getStatusMessage(); String getInstallPath(); Map<String, Integer> getResources(); SlotStatus changeState(SlotLifecycleState state); SlotStatus changeInstanceId(String instanceId); SlotStatus changeAssignment(SlotLifecycleState state, Assignment assignment, Map<String, Integer> resources); SlotStatus changeExpectedState(SlotLifecycleState expectedState, Assignment expectedAssignment); SlotStatus changeStatusMessage(String statusMessage); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Function<SlotStatus, String> idGetter(); static Function<SlotStatus, UUID> uuidGetter(); static Function<SlotStatus, String> locationGetter();  }
@Test public void testEquivalence() { UUID appleId = UUID.randomUUID(); URI appleSelf = URI.create("internal: URI appleExternalUri = URI.create("external: String applePath = "/apple"; UUID bananaId = UUID.randomUUID(); URI bananaSelf = URI.create("internal: URI bananaExternalUri = URI.create("external: String bananaPath = "/banana"; equivalenceTester() .addEquivalentGroup( createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", TERMINATED, null, applePath, ImmutableMap.<String, Integer>of()), createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", TERMINATED, null, applePath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(bananaId, appleSelf, appleExternalUri, "instance", "/location", TERMINATED, null, applePath, ImmutableMap.<String, Integer>of()), createSlotStatus(bananaId, appleSelf, appleExternalUri, "instance", "/location", TERMINATED, null, applePath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", RUNNING, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of()), createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", RUNNING, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(bananaId, bananaSelf, bananaExternalUri, "instance", "/location", RUNNING, APPLE_ASSIGNMENT, bananaPath, ImmutableMap.<String, Integer>of()), createSlotStatus(bananaId, bananaSelf, bananaExternalUri, "instance", "/location", RUNNING, APPLE_ASSIGNMENT, bananaPath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", RUNNING, BANANA_ASSIGNMENT, bananaPath, ImmutableMap.<String, Integer>of()), createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", RUNNING, BANANA_ASSIGNMENT, bananaPath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", STOPPED, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of()), createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", STOPPED, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of())) .addEquivalentGroup( createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", UNKNOWN, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of()), createSlotStatus(appleId, appleSelf, appleExternalUri, "instance", "/location", UNKNOWN, APPLE_ASSIGNMENT, applePath, ImmutableMap.<String, Integer>of())) .check(); }