Replaced inner class by lambda in ObserverTest#testObserver().
Separated out this code in new method to prevent JVM crash.