Comments (2)
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>").$()
)
);
from thincrest.
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").$()
)
);
from thincrest.
Related Issues (20)
- Implement 'requireThat' and 'assumeThat' HOT 1
- Error message printed on failure in matcher execution is not descriptive HOT 8
- Improve method selecting mechanism
- Document improvement
- Message shown on failure due to check(Function,Predicate) method looks poor.
- Introduce 'strict' mode for 'call' mechanism.
- Code clean up
- MissingFormatArgumentException is thrown
- Make output format more natural Java-like
- Expose "function" and "predicate" methods
- Failure Message Improvement
- Implement 'inOrder' feature
- Prohibit using 'allOf' and 'anyOf' without arguments
- Ensure mutator function is called even if checkers are not set
- Checking elements in a collection is awkward
- Remove runtime dependency on JUnit
- Support assertThrows HOT 1
- Separate precondition checking mechanism from thincrest
- TestSkippedException should be thrown when an assumption is violated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thincrest.