### Question:
NodePreparers { public static NodePreparer getPreparerFor(CloudNode node) { String nodeId = node.getId(); if (testing) { return preparerForTest; } else { synchronized (NodePreparers.class) { if (!preparers.containsKey(nodeId)) { NodePreparer preparer = new NodePreparer(node); preparers.put(nodeId, preparer); } } return preparers.get(nodeId); } }  static NodePreparer getPreparerFor(CloudNode node); static NodePreparer preparerForTest; static boolean testing; }### Answer:
@Test public void shouldRetriveTheSameInstance() { NodePreparer preparer1 = NodePreparers.getPreparerFor(node1); NodePreparer preparer2 = NodePreparers.getPreparerFor(node1); assertTrue(preparer1 == preparer2); }
@Test public void shouldRetriveDifferentInstances() { NodePreparer preparer1 = NodePreparers.getPreparerFor(node1); NodePreparer preparer2 = NodePreparers.getPreparerFor(node2); assertTrue(preparer1 != preparer2); }