package jetbrains.mps.closures.test;
/*Generated by MPS */
import junit.framework.TestCase;
import jetbrains.mps.baseLanguage.closures.runtime.Wrappers;
import jetbrains.mps.baseLanguage.closures.runtime._FunctionTypes;
import junit.framework.Assert;
public class FinalClosureParameter_Test extends TestCase {
public void test_runnable() throws Exception {
final Wrappers._T<String> foo = new Wrappers._T<String>("foo");
this.acceptFunction(new _FunctionTypes._void_P1_E0<String>() {
public void invoke(final String s) {
Runnable r = new Runnable() {
@Override
public void run() {
foo.value = s;
}
};
r.run();
}
});
Assert.assertEquals("BAR", foo.value);
}
public void test_logging() throws Exception {
final Wrappers._int count = new Wrappers._int(0);
acceptFunction(new _FunctionTypes._void_P1_E0<String>() {
public void invoke(String s) {
count.value++;
}
});
Assert.assertSame(1, count.value);
}
public FinalClosureParameter_Test() {
}
public void acceptFunction(_FunctionTypes._void_P1_E0<? super String> fun) {
fun.invoke("BAR");
}
}