Added unit-test for entity classes.

Fixed some FindBug errors.