package gx.realtime.acceptance_test;

import gx.realtime.Document;
import gx.realtime.IdentificationLoader;
import gx.realtime.RealtimeLoader;
import gx.realtime.RealtimeOptions;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

/**
 *
 */
public class LoaderTest
{
    @Test
    public void testLoader()
    {
        String clientId;
        try {
            clientId = IdentificationLoader.usingDefault().getClientId();
        } catch (IOException e) {
            fail("Could not load client ID");
            e.printStackTrace();
            return;
        }
        
        RealtimeOptions options = new RealtimeOptions();
        options.setClientId(clientId);
        options.setDocId("0B6gFLa0mYRcOc3NKTmtwdV9idHM");

        options.setInitializeModel((model) -> {
            System.out.println("we haz model");
        });
        
        options.setOnFileLoaded((document) -> {
            System.out.println("we haz document");
        });
        
        RealtimeLoader loader = new RealtimeLoader(options);
        loader.start();
    }
}

@@ -190,24 +190,59 @@
 .junit.Test;
+%0Aimport org.mockito.ArgumentCaptor;
 %0A%0Aimport jav
@@ -377,40 +377,127 @@
     
-@Test%0A    public void testLoader
+/**%0A     * Get the client ID from the default configuration file.%0A     * @return%0A     */%0A    private String getClientId
 ()%0A 
@@ -723,24 +723,52 @@
 ackTrace();%0A
+            System.exit(1);%0A
             
@@ -773,16 +773,21 @@
   return
+ null
 ;%0A      
@@ -790,32 +790,114 @@
       %7D%0A        
+return clientId;%0A    %7D%0A    %0A    @Test%0A    public void testDocumentIsLoaded()%0A    %7B
 %0A        Realtim
@@ -966,24 +966,29 @@
 lientId(
-c
+getC
 lientId
+()
 );%0A     
@@ -1043,117 +1043,8 @@
 M%22);
-%0A%0A        options.setInitializeModel((model) -%3E %7B%0A            System.out.println(%22we haz model%22);%0A        %7D);
 %0A   
@@ -1230,16 +1230,25 @@
 tions);%0A
+        %0A
         
@@ -1259,20 +1259,106 @@
 er.start();%0A
+        %0A        verify(options.getOnFileLoaded()).onFileLoaded(isA(Document.class));%0A
     %7D%0A%7D%0A

Add verification using Mockito in the LoaderTest.