Fixed equals method to verify casting and avoid NPE
Using hamcrest matchers
Proper naming of constants
Removed unused code