### Question:
SessionSingletonCommandsFactory { public static CopySelectionSessionCommand getInstanceCopy( final Event<?> commandExecutedEvent, SessionManager sessionManager) { final ClientSession currentSession = sessionManager.getCurrentSession(); if (!copySessionInstances.containsKey(currentSession)) { final CopySelectionSessionCommand copySelectionSessionCommand = new CopySelectionSessionCommand((Event<CopySelectionSessionCommandExecutedEvent>) commandExecutedEvent, sessionManager); return copySelectionSessionCommand; } final CopySelectionSessionCommand copySelectionSessionCommand = copySessionInstances.get(currentSession); return copySelectionSessionCommand; }  static void createOrPut(AbstractSelectionAwareSessionCommand<EditorSession> command, SessionManager sessionManager); static CopySelectionSessionCommand getInstanceCopy(
            final Event<?> commandExecutedEvent,
            SessionManager sessionManager); static DeleteSelectionSessionCommand getInstanceDelete(
            final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
            final ManagedInstance<CanvasCommandFactory<AbstractCanvasHandler>> canvasCommandFactoryInstance,
            final Event<CanvasClearSelectionEvent> clearSelectionEvent,
            final DefinitionUtils definitionUtils,
            final SessionManager sessionManager);  }### Answer:
@Test public void testGetInstancesCopy() { final CopySelectionSessionCommand copySelectionSessionCommand = new CopySelectionSessionCommand(null, sessionManager); final CopySelectionSessionCommand instanceCopy = SessionSingletonCommandsFactory.getInstanceCopy(null, sessionManager); assertEquals(copySelectionSessionCommand, instanceCopy); when(sessionManager.getCurrentSession()).thenReturn(session2); final CopySelectionSessionCommand copySelectionSessionCommand2 = new CopySelectionSessionCommand(null, sessionManager); final CopySelectionSessionCommand instanceCopy2 = SessionSingletonCommandsFactory.getInstanceCopy(null, sessionManager); assertEquals(copySelectionSessionCommand2, instanceCopy2); }
@Test public void testGetInstancesOnFetchCopy() { final CopySelectionSessionCommand instanceCopy = SessionSingletonCommandsFactory.getInstanceCopy(null, sessionManager); final CopySelectionSessionCommand instanceCopy2 = SessionSingletonCommandsFactory.getInstanceCopy(null, sessionManager); assertEquals(instanceCopy, instanceCopy2); }
@Test(expected = IllegalStateException.class) public void testGetInstancesOnFetchCopyError() { final CopySelectionSessionCommand instanceCopy = SessionSingletonCommandsFactory.getInstanceCopy(null, sessionManager); final CopySelectionSessionCommand instanceCopy2 = new CopySelectionSessionCommand(null, sessionManager); }