### Question:
SupportedRuntimes { public boolean isSupported(String runtime) { boolean ret; if (Strings.isNullOrEmpty(latestSupportedRuntime)) { ret = true; } else { ret = versionComparator.compare(() -> runtime, () -> latestSupportedRuntime) <= 0; } return ret; }  boolean isSupported(String runtime);  }### Answer:
@Test public void testAllowEverything() { Assert.assertTrue("Latest runtime is not configured, shall support everything", underTest.isSupported("does not matter")); }
@Test public void testSupported() { Whitebox.setInternalState(underTest, "latestSupportedRuntime", "7.1.0"); Assert.assertTrue(underTest.isSupported("7.1.0")); Assert.assertTrue(underTest.isSupported("7.1.0.0")); Assert.assertTrue(underTest.isSupported("7.0.99.0")); Assert.assertTrue(underTest.isSupported("7.0.99")); }
@Test public void testNotSupported() { Whitebox.setInternalState(underTest, "latestSupportedRuntime", "7.1.0"); Assert.assertFalse(underTest.isSupported("7.2.0")); }
@Test public void testInvalidVersions() { Whitebox.setInternalState(underTest, "latestSupportedRuntime", "7.1.0"); Assert.assertFalse(underTest.isSupported("blah")); Assert.assertFalse(underTest.isSupported("7")); Assert.assertFalse(underTest.isSupported("8")); }