-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support static call by 'Call' mechanism #18
Labels
Comments
Following is an example to call static method. Function<Object, String> func = call(String.class, "format", "<me=%s, %s>", varargs(THIS, "hello")).$();
System.out.println(func.toString());
System.out.println(func.apply("world"));
Crest.assertThat(
func,
allOf(
Crest.asString("toString").equalTo("@String.format[<me=%s, %s>, Object:varargs[(THIS), hello]]").$(),
Crest.asString(call("apply", "world").$()).equalTo("<me=world, hello>").$()
)
); |
Not only that, we are now able to call an instance method not on a target object by following way. Function<Object, String> func = callOn("Hello world", "indexOf", THIS).andThen("toString").$();
System.out.println(func.toString());
System.out.println(func.apply("world"));
Crest.assertThat(
func,
allOf(
Crest.asString("toString").equalTo("Hello world@indexOf[(THIS)]->@toString[]").$(),
Crest.asString(call("apply", "world").$()).equalTo("6").$()
)
); |
dakusui
added a commit
that referenced
this issue
Aug 27, 2018
dakusui
added a commit
that referenced
this issue
Aug 27, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support static call by 'Call' mechanism.
The text was updated successfully, but these errors were encountered: