Add JUnit test for metrics