So I want to create an assertion class like how AssertJ works. I'm having trouble getting started.
public class Assertion { static object assertThis(Object o){} static Integer assertThis(int i){} static String assertThis(String s){} static Object isNotNull(){} } My question is how does JUNIT take in a particular object/string/int and store it? Let's say I pass in a Assertion.assertThis("hello").isNotNull() I should be getting a string object back. Do I need a field to store the object file? And how is that changed by the different objects being passed through the assertThis method?
assertThis(...).isNotNull(). Are you sure you're not thinking of AssertJ? If so, then take a look at §2.6.2 Custom Assertions.assertThis()should return an helper (or intermediate) object that has theisNotNull()method...x instanceof Objectwill return false for x equal null.