package arez.spy;

import arez.AbstractArezTest;
import java.util.HashMap;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ActionCompletedEventTest
  extends AbstractArezTest
{
  @Test
  public void basicOperation()
  {
    final String name = ValueUtil.randomString();
    final boolean tracked = true;
    final Object[] parameters = new Object[ 0 ];
    final boolean returnsResult = true;
    final Object result = new Object();
    final Throwable throwable = null;
    final long duration = 33;
    final ActionCompletedEvent event =
      new ActionCompletedEvent( name, tracked, parameters, returnsResult, result, throwable, duration );

    assertEquals( event.getName(), name );
    assertEquals( event.isTracked(), tracked );
    assertEquals( event.getParameters(), parameters );
    assertEquals( event.returnsResult(), returnsResult );
    assertEquals( event.getResult(), result );
    assertEquals( event.getThrowable(), throwable );
    assertEquals( event.getDuration(), duration );

    final HashMap<String, Object> data = new HashMap<>();
    event.toMap( data );

    assertEquals( data.get( "type" ), "ActionCompleted" );
    assertEquals( data.get( "action" ), name );
    assertEquals( data.get( "tracked" ), tracked );
    assertEquals( data.get( "parameters" ), parameters );
    assertEquals( data.get( "duration" ), duration );
    assertEquals( data.get( "normalCompletion" ), true );
    assertEquals( data.get( "errorMessage" ), null );
    assertEquals( data.get( "returnsResult" ), true );
    assertEquals( data.get( "result" ), result );
    assertEquals( data.size(), 9 );
  }
}

@@ -1697,11 +1697,1465 @@
 9 );%0A  %7D
+%0A%0A  @Test%0A  public void basicOperation_exception()%0A  %7B%0A    final String name = ValueUtil.randomString();%0A    final boolean tracked = true;%0A    final Object%5B%5D parameters = new Object%5B 0 %5D;%0A    final boolean returnsResult = true;%0A    final Object result = null;%0A    final Throwable throwable = new Exception( %22X%22 );%0A    final long duration = 33;%0A    final ActionCompletedEvent event =%0A      new ActionCompletedEvent( name, tracked, parameters, returnsResult, result, throwable, duration );%0A%0A    assertEquals( event.getName(), name );%0A    assertEquals( event.isTracked(), tracked );%0A    assertEquals( event.getParameters(), parameters );%0A    assertEquals( event.returnsResult(), returnsResult );%0A    assertEquals( event.getResult(), result );%0A    assertEquals( event.getThrowable(), throwable );%0A    assertEquals( event.getDuration(), duration );%0A%0A    final HashMap%3CString, Object%3E data = new HashMap%3C%3E();%0A    event.toMap( data );%0A%0A    assertEquals( data.get( %22type%22 ), %22ActionCompleted%22 );%0A    assertEquals( data.get( %22action%22 ), name );%0A    assertEquals( data.get( %22tracked%22 ), tracked );%0A    assertEquals( data.get( %22parameters%22 ), parameters );%0A    assertEquals( data.get( %22duration%22 ), duration );%0A    assertEquals( data.get( %22normalCompletion%22 ), false );%0A    assertEquals( data.get( %22errorMessage%22 ), %22X%22 );%0A    assertEquals( data.get( %22returnsResult%22 ), true );%0A    assertEquals( data.get( %22result%22 ), null );%0A    assertEquals( data.size(), 9 );%0A  %7D
 %0A%7D%0A

Add some additional test coverage