package jetbrains.mps.closures.test;

/*Generated by MPS */

import org.junit.jupiter.api.Test;
import jetbrains.mps.baseLanguage.closures.runtime.Wrappers;
import org.junit.Assert;
import jetbrains.mps.baseLanguage.closures.runtime._FunctionTypes;

public class FinalClosureParameter_Test {
  @Test
  public void test_runnable() throws Exception {
    final Wrappers._T<String> foo = new Wrappers._T<String>("foo");
    this.acceptFunction((final String s) -> {
      Runnable r = new Runnable() {
        @Override
        public void run() {
          foo.value = s;
        }
      };
      r.run();
    });
    Assert.assertEquals("BAR", foo.value);
  }
  @Test
  public void test_logging() throws Exception {
    final Wrappers._int count = new Wrappers._int(0);
    acceptFunction((String s) -> count.value++);
    Assert.assertSame(1, count.value);
  }
  public void acceptFunction(_FunctionTypes._void_P1_E0<? super String> fun) {
    fun.invoke("BAR");
  }
}
