added JUnit tests

concerns #257