I am going through a codebase that I found in github.
I found a set of lines in the code that contains the following function:assertThat
.Any help is appreciated.
myObject = someDao.foo(obj);
assertThat(myObject.getUpdated,isAfter(updated));
This is an assertion from a lib called Hamcrest used to ensure certain states in a program. If they fail they throw an Exception with some output to help understanding what goes wrong. Its like assert or the assertEquals methods from JUnit. And so they are normally used in a test class but you can also use them in a normal program to ensure states you expect (Preconditions, Postconditions,Class Invariants or Design by contract).
So this ensures the Date getUpdated
> Date updated
when this is wrong the Exception is thrown.