Fix JSO tests from previous commits

This commit is contained in:
Alexey Andreev 2017-05-31 22:52:34 +03:00
parent 933a5c3efc
commit ad14176277

View File

@ -43,22 +43,20 @@ public class FunctorTest {
@Test @Test
public void functorWithDefaultMethodPassed() { public void functorWithDefaultMethodPassed() {
JSFunctionWithDefaultMethod javaFunction = (s) -> s + " returned"; assertEquals(123, callFunctionWithDefaultMethod(s -> s + 100));
String returned = javaFunction.defaultMethod();
assertEquals(returned, "Content returned");
} }
@JSBody(params = "f", script = "return f(23);")
private static native int callFunctionWithDefaultMethod(JSFunctionWithDefaultMethod f);
@Test @Test
public void functorWithStaticMethodPassed() { public void functorWithStaticMethodPassed() {
JSFunctionWithStaticMethod javaFunction = (s) -> s + " returned"; assertEquals(123, callFunctionWithStaticMethod(s -> s + 100));
String returned = javaFunction.apply(JSFunctionWithStaticMethod.staticMethod());
assertEquals(returned, "Content returned");
} }
@JSBody(params = "f", script = "return f(23);")
private static native int callFunctionWithStaticMethod(JSFunctionWithStaticMethod f);
@Test @Test
public void propertyWithNonAlphabeticFirstChar() { public void propertyWithNonAlphabeticFirstChar() {
WithProperties wp = getWithPropertiesInstance(); WithProperties wp = getWithPropertiesInstance();
@ -78,21 +76,21 @@ public class FunctorTest {
@JSFunctor @JSFunctor
interface JSBiFunction extends JSObject { interface JSBiFunction extends JSObject {
int apply(int a, int b); int foo(int a, int b);
} }
@JSFunctor @JSFunctor
interface JSFunctionWithDefaultMethod extends JSObject { interface JSFunctionWithDefaultMethod extends JSObject {
String apply(String a); int foo(int a);
default String defaultMethod() { default String defaultMethod() {
return apply("Content"); return "Content";
} }
} }
@JSFunctor @JSFunctor
interface JSFunctionWithStaticMethod extends JSObject { interface JSFunctionWithStaticMethod extends JSObject {
String apply(String a); int foo(int a);
static String staticMethod() { static String staticMethod() {
return "Content"; return "Content";