public void checkForUpgradeAndExtraProperties() throws IOException {
        if (upgradesEnabled()) {
            checkForUpgradeAndExtraProperties(systemEnvironment.getAgentMd5(), systemEnvironment.getGivenAgentLauncherMd5(),
                    systemEnvironment.getAgentPluginsMd5(), systemEnvironment.getTfsImplMd5());
        } else {
            LOGGER.debug("[Agent Upgrade] Skipping check as there is no wrapping launcher to relaunch the agent JVM...");
        }
    }
@Test
    void checkForUpgradeShouldKillAgentIfAgentMD5doesNotMatch() {
        when(systemEnvironment.getAgentMd5()).thenReturn("old-agent-md5");
        expectHeaderValue(SystemEnvironment.AGENT_CONTENT_MD5_HEADER, "new-agent-md5");

        RuntimeException toBeThrown = new RuntimeException("Boo!");
        doThrow(toBeThrown).when(jvmExitter).jvmExit(anyString(), anyString(), anyString());

        try {
            agentUpgradeService.checkForUpgradeAndExtraProperties();
            fail("should have done jvm exit");
        } catch (Exception e) {
            assertThat(toBeThrown).isSameAs(e);
        }

        verify(jvmExitter).jvmExit("itself", "old-agent-md5", "new-agent-md5");
    }