@@ -0,0 +1,3033 @@
+package arez.integration.verify;%0A%0Aimport arez.Arez;%0Aimport arez.Disposable;%0Aimport arez.annotations.ArezComponent;%0Aimport arez.annotations.Reference;%0Aimport arez.annotations.ReferenceId;%0Aimport arez.annotations.Repository;%0Aimport arez.component.Identifiable;%0Aimport arez.component.TypeBasedLocator;%0Aimport arez.component.Verifiable;%0Aimport arez.integration.AbstractArezIntegrationTest;%0Aimport java.util.HashMap;%0Aimport java.util.Objects;%0Aimport javax.annotation.Nonnull;%0Aimport org.testng.annotations.Test;%0A%0Apublic class VerifyIntegrationTest%0A  extends AbstractArezIntegrationTest%0A%7B%0A  @Test%0A  public void scenario()%0A    throws Throwable%0A  %7B%0A    final VerifyIntegrationTest_Model2Repository repository =%0A      VerifyIntegrationTest_Model2Repository.newRepository();%0A%0A    final TypeBasedLocator locator = new TypeBasedLocator();%0A    Arez.context().registerLocator( locator );%0A%0A    final HashMap%3CObject, Model1%3E entities1 = new HashMap%3C%3E();%0A    final HashMap%3CObject, Model2%3E entities2 = new HashMap%3C%3E();%0A    locator.registerLookup( Model1.class, entities1::get );%0A    locator.registerLookup( Model2.class, entities2::get );%0A%0A    final Model2 model2a = repository.create();%0A    final Object model2aId = Objects.requireNonNull( Identifiable.getArezId( model2a ) );%0A    entities2.put( model2aId, model2a );%0A%0A    final Model1 model1 = Model1.create( model2aId );%0A    final Object model1Id = Objects.requireNonNull( Identifiable.getArezId( model1 ) );%0A    entities1.put( model1Id, model1 );%0A%0A    // Should verify as will link correctly%0A    Verifiable.verify( model1 );%0A%0A    %7B%0A      entities2.clear();%0A%0A      // Fail to verify as related is missing%0A      assertInvariant( () -%3E Verifiable.verify( model1 ),%0A                       %22Reference method named 'getModel2' invoked on component named 'Model1.0' missing related entity. Id = 0%22 );%0A      entities2.put( model2aId, model2a );%0A    %7D%0A%0A    %7B%0A      entities1.clear();%0A%0A      // Fail to verify as missing self%0A      assertInvariant( () -%3E Verifiable.verify( model1 ),%0A                       %22Attempted to lookup self in Locator with type VerifyIntegrationTest.Model1 and id '0' but unable to locate self. Actual value: null%22 );%0A%0A      entities1.put( model1Id, model1 );%0A    %7D%0A%0A    Disposable.dispose( model1 );%0A%0A    // Fail to verify as disposed%0A    assertInvariant( () -%3E Verifiable.verify( model1 ),%0A                     %22Method named 'verify' invoked on disposed component named 'Model1.0'%22 );%0A  %7D%0A%0A  @ArezComponent( allowEmpty = true )%0A  static abstract class Model1%0A  %7B%0A    @Nonnull%0A    private final Object _model2Id;%0A%0A    static Model1 create( @Nonnull final Object model2Id )%0A    %7B%0A      return new VerifyIntegrationTest_Arez_Model1( model2Id );%0A    %7D%0A%0A    Model1( @Nonnull final Object model2Id )%0A    %7B%0A      _model2Id = model2Id;%0A    %7D%0A%0A    @Reference%0A    abstract Model2 getModel2();%0A%0A    @ReferenceId%0A    @Nonnull%0A    final Object getModel2Id()%0A    %7B%0A      return _model2Id;%0A    %7D%0A  %7D%0A%0A  @Repository%0A  @ArezComponent( allowEmpty = true )%0A  static abstract class Model2%0A  %7B%0A  %7D%0A%7D%0A

Add integration test for verify