JUnit tests

Tests for everything. Work in progress.