package arez.integration.observable;

import arez.Arez;
import arez.annotations.ArezComponent;
import arez.annotations.Observable;
import arez.integration.AbstractArezIntegrationTest;
import javax.annotation.Nonnull;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class NonnullObservableIntegrationTest
  extends AbstractArezIntegrationTest
{
  @SuppressWarnings( "ConstantConditions" )
  @Test
  public void disallowNullInSetter()
    throws Throwable
  {
    final Model model = Model.create( ValueUtil.randomString() );
    assertThrows( AssertionError.class, () -> model.setLastName( null ) );
  }

  @SuppressWarnings( "ConstantConditions" )
  @Test
  public void disallowNullInInitializer()
    throws Throwable
  {
    assertThrows( NullPointerException.class, () -> Model.create( null ) );
  }

  @ArezComponent
  static abstract class Model
  {
    @Nonnull
    static Model create( final String lastName )
    {
      return new NonnullObservableIntegrationTest_Arez_Model( lastName );
    }

    @Observable
    @Nonnull
    abstract String getLastName();

    abstract void setLastName( @Nonnull String lastName );
  }
}

@@ -601,24 +601,57 @@
 ing() );%0A   
+ Arez.context().safeAction( () -%3E
  assertThrow
@@ -698,32 +698,34 @@
 LastName( null )
+ )
  );%0A  %7D%0A%0A  @Supp

Fix compile error