package arez.component;

import arez.AbstractArezTest;
import arez.ArezTestUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class VerifiableTest
  extends AbstractArezTest
{
  static class TestElement
    implements Verifiable
  {
    boolean _verified;

    @Override
    public void verify()
    {
      _verified = true;
    }
  }

  @Test
  public void verifiableElement()
    throws Exception
  {
    final TestElement element = new TestElement();
    assertFalse( element._verified );
    Verifiable.verify( element );
    assertTrue( element._verified );
  }

  @Test
  public void verifiableElement_verifyDisabled()
    throws Exception
  {
    ArezTestUtil.disableVerify();
    final TestElement element = new TestElement();
    assertFalse( element._verified );
    Verifiable.verify( element );
    assertFalse( element._verified );
  }

  @Test
  public void nonLinkableElement()
    throws Exception
  {
    // Should produce no exceptions
    Verifiable.verify( new Object() );
  }
}

@@ -74,16 +74,44 @@
 stUtil;%0A
+import java.io.IOException;%0A
 import o
@@ -134,24 +134,24 @@
 tions.Test;%0A
-
 import stati
@@ -388,24 +388,242 @@
 %0A    %7D%0A  %7D%0A%0A
+  static class TestBadElement%0A    implements Verifiable%0A  %7B%0A    boolean _verified;%0A%0A    @Override%0A    public void verify()%0A      throws Exception%0A    %7B%0A      _verified = true;%0A      throw new IOException();%0A    %7D%0A  %7D%0A%0A
   @Test%0A  pu
@@ -1228,16 +1228,16 @@
 eptions%0A
-
     Veri
@@ -1270,11 +1270,272 @@
 ) );%0A  %7D
+%0A%0A  @Test%0A  public void verifiableBadElement()%0A  %7B%0A    final TestBadElement element = new TestBadElement();%0A    assertFalse( element._verified );%0A    assertThrows( IOException.class, () -%3E Verifiable.verify( element ) );%0A    assertTrue( element._verified );%0A  %7D
 %0A%7D%0A

Add aditional test to make sure a failed verify is possible