Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54435

Add tests to HealthAnalyzerCommon

XMLWordPrintable

      In order to properly test if it is executed on a slave, it requires end-to-end tests (using JenkinsRule).

       

      The tests should as well integrate this tests back:

      @Test
      public void ifCheckedPerformOsCheck_shouldThrowException_withCorrectValue() throws Exception {
          initializeOperatingSystemOs("windows");
          try {
              healthAnalyzerCommon.ifCheckedPerformOsCheck(OperatingSystem.LINUX, true);
              fail();
          } catch (AbortException e) {
              assertEquals(e.getMessage(), String.format("Your operating system: %s is not %s.", "linux",
                      OperatingSystem.getOs()));
          }
      }
      
      @Test
      public void ifCheckedPerformOsCheck_doesNotThrowException() throws Exception {
          initializeOperatingSystemOs("windows");
          healthAnalyzerCommon.ifCheckedPerformOsCheck(OperatingSystem.WINDOWS, true);
      }
      
      @Test
      public void isCheckedPerformWindowsInstallationCheck_throwsCorrectExceptionValue() throws Exception {
          if (OperatingSystem.IS_WINDOWS) {
              try {
                  healthAnalyzerCommon.isRegistryExist(NON_EXISTING_REGISTRY);
                  fail();
              } catch (AbortException e) {
                  assertEquals(e.getMessage(), DUMMY_PRODUCT_NAME + " is not installed. Please install it first.");
              }
          }
      }
      

            gront Daniel Gront
            gront Daniel Gront
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: