AssertJ is a library which provides fluent strongly-typed assertions to use in unit tests.
Example of assertions written with AssertJ:
import io.github.uthark.blog.assertj.Assertions.assertThat; // ... within @Test User result = userDao.findByLogin("username"); assertThat(result). isNotNull(). isActive(). hasLogin("username"); As you can see assertions look much more readable.
In this post I will show how one can implement custom JUnit @Rule.
As an example let’s take Mockito and implement custom rule which will initialize Mocks in test class.
By default, Mockito provides the following methods of mock initialization:
If anyone needs invites to atom.io, text editor from github - ask me in comments. I do have 3 invites to share.
This is a very nice series of posts about Scala by Venkat Subramaniam
The Elegance of Scala Sensible Typing and Optional Items Cute Classes and Pure OO Functional Style of Programming Working with Collections Creating Higher Order Functions Pattern Matching XML as First Class Citizen Recursions and Tail Call Optimization Using Traits Chaining Traits Concurrency in Scala
Found in sources:
try { // do some business logic. } catch (Exception e) { errorBean.addError("System exception. Unable to locate life fee."); } This is just awesome!