package replicant;

import arez.Arez;
import org.realityforge.replicant.client.AbstractReplicantTest;
import org.testng.IHookCallBack;
import org.testng.IHookable;
import org.testng.ITestResult;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ChannelAddressTest
  extends AbstractReplicantTest
  implements IHookable
{
  enum TestSystem
  {
    A, B
  }

  @Override
  public void run( final IHookCallBack callBack, final ITestResult testResult )
  {
    Arez.context().safeAction( () -> callBack.runTestMethod( testResult ) );
  }

  @SuppressWarnings( "EqualsWithItself" )
  @Test
  public void basicOperation()
  {
    final ChannelAddress address1 = new ChannelAddress( TestSystem.A );
    final ChannelAddress address2 = new ChannelAddress( TestSystem.B, 1 );

    assertEquals( address1.getSystem(), TestSystem.class );
    assertEquals( address1.getChannelType(), TestSystem.A );
    assertEquals( address1.getId(), null );
    assertEquals( address1.toString(), "TestSystem.A" );
    assertEquals( address1.equals( address1 ), true );
    assertEquals( address1.equals( address2 ), false );
    assertEquals( address1.compareTo( address1 ), 0 );
    assertEquals( address1.compareTo( address2 ), -1 );

    assertEquals( address2.getSystem(), TestSystem.class );
    assertEquals( address2.getChannelType(), TestSystem.B );
    assertEquals( address2.getId(), 1 );
    assertEquals( address2.toString(), "TestSystem.B:1" );
    assertEquals( address2.equals( address1 ), false );
    assertEquals( address2.equals( address2 ), true );
    assertEquals( address2.compareTo( address1 ), 1 );
    assertEquals( address2.compareTo( address2 ), 0 );
  }
}

@@ -99,101 +99,8 @@
 st;%0A
-import org.testng.IHookCallBack;%0Aimport org.testng.IHookable;%0Aimport org.testng.ITestResult;%0A
 impo
@@ -235,31 +235,8 @@
 est%0A
-  implements IHookable%0A
 %7B%0A  
@@ -273,186 +273,8 @@
  %7D%0A%0A
-  @Override%0A  public void run( final IHookCallBack callBack, final ITestResult testResult )%0A  %7B%0A    Arez.context().safeAction( () -%3E callBack.runTestMethod( testResult ) );%0A  %7D%0A%0A
   @S
@@ -498,24 +498,65 @@
 em.B, 1 );%0A%0A
+    Arez.context().safeAction( () -%3E %7B%0A  
     assertEq
@@ -595,32 +595,34 @@
 System.class );%0A
+  
     assertEquals
@@ -662,24 +662,26 @@
 System.A );%0A
+  
     assertEq
@@ -708,32 +708,34 @@
 (), null );%0A    
+  
 assertEquals( ad
@@ -767,32 +767,34 @@
 ystem.A%22 );%0A    
+  
 assertEquals( ad
@@ -824,32 +824,34 @@
  ), true );%0A    
+ 
+ 
 assertEquals( ad
@@ -882,32 +882,34 @@
 ), false );%0A    
+  
 assertEquals( ad
@@ -939,24 +939,26 @@
 ss1 ), 0 );%0A
+  
     assertEq
@@ -1002,24 +1002,26 @@
  -1 );%0A%0A    
+  
 assertEquals
@@ -1060,24 +1060,26 @@
 em.class );%0A
+  
     assertEq
@@ -1123,32 +1123,34 @@
 System.B );%0A    
+ 
+ 
 assertEquals( ad
@@ -1162,32 +1162,34 @@
 2.getId(), 1 );%0A
+  
     assertEquals
@@ -1227,24 +1227,26 @@
 tem.B:1%22 );%0A
+  
     assertEq
@@ -1285,32 +1285,34 @@
 ), false );%0A    
+  
 assertEquals( ad
@@ -1342,32 +1342,34 @@
  ), true );%0A    
+ 
+ 
 assertEquals( ad
@@ -1403,24 +1403,26 @@
 ), 1 );%0A    
+ 
+ 
 assertEquals
@@ -1460,14 +1460,23 @@
 ), 0 );%0A
+    %7D );%0A
   %7D%0A%7D%0A

Remove hook to simplify test