package org.realityforge.replicant.server.ee.rest;

import javax.ws.rs.core.Response;
import org.realityforge.replicant.server.transport.ReplicantSession;
import org.realityforge.replicant.server.transport.ReplicantSessionManager;
import org.testng.annotations.Test;
import static org.mockito.Mockito.*;
import static org.testng.Assert.*;

public class SessionRestServiceTest
{
  @Test
  public void poll_dataAvailable()
    throws Exception
  {
    final ReplicantSessionManager sessionManager = mock( ReplicantSessionManager.class );
    final AbstractSessionRestService resource = newResource( sessionManager );

    when( sessionManager.createSession() ).
      thenReturn( new ReplicantSession( null, "2222" ) );

    final Response token = resource.createSession();

    assertEquals( token.getEntity(), "2222" );
  }

  protected AbstractSessionRestService newResource( final ReplicantSessionManager sessionManager )
    throws Exception
  {
    return new AbstractSessionRestService()
    {
      @Override
      protected ReplicantSessionManager getSessionManager()
      {
        return sessionManager;
      }
    };
  }
}

@@ -45,16 +45,110 @@
 .rest;%0A%0A
+import javax.annotation.Nonnull;%0Aimport javax.transaction.TransactionSynchronizationRegistry;%0A
 import j
@@ -1082,24 +1082,39 @@
 ice()%0A    %7B%0A
+      @Nonnull%0A
       @Overr
@@ -1223,16 +1223,194 @@
 %0A      %7D
+%0A%0A      @Nonnull%0A      @Override%0A      protected TransactionSynchronizationRegistry getRegistry()%0A      %7B%0A        return mock( TransactionSynchronizationRegistry.class );%0A      %7D
 %0A    %7D;%0A

Implement missing method