### Question:
AbstractMainClass { protected AbstractMainClass(Logger logger, String usage) throws GrinderException { m_usage = new FixedWidthFormatter(FixedWidthFormatter.Align.LEFT, FixedWidthFormatter.Flow.WORD_WRAP, 80).format(usage); m_logger = logger; if (!JVM.getInstance().haveRequisites(m_logger)) { throw new LoggedInitialisationException("Unsupported JVM"); } } protected  AbstractMainClass(Logger logger, String usage);   }### Answer:
@Test public void testAbstractMainClass() throws Exception { final Logger logger = mock(Logger.class); final String myUsage = "do some stuff"; final MyMainClass mainClass = new MyMainClass(logger, myUsage); assertSame(logger, mainClass.getLogger()); final String javaVersion = System.getProperty("java.version"); try { try { System.setProperty("java.version", "whatever"); new MyMainClass(logger, myUsage); fail("Expected VersionException"); } catch (VersionException e) { } try { System.setProperty("java.version", "1.3"); new MyMainClass(logger, myUsage); fail("Expected LoggedInitialisationException"); } catch (LoggedInitialisationException e) { AssertUtilities.assertContains(e.getMessage(), "Unsupported"); verify(logger).error(contains("incompatible version"), isA(JVM.class), isA(String.class)); } } finally { System.setProperty("java.version", javaVersion); } final LoggedInitialisationException barfError = mainClass.barfError("foo"); assertEquals("foo", barfError.getMessage()); verify(logger).error(contains("foo")); final LoggedInitialisationException barfUsage = mainClass.barfUsage(); AssertUtilities.assertContains(barfUsage.getMessage(), myUsage); verify(logger).error(contains(myUsage)); verifyNoMoreInteractions(logger); }