diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/FolderTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/FolderTest.java index 0b82903c..263af321 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/FolderTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/FolderTest.java @@ -417,7 +417,7 @@ private void copyViaHttp(Folder f, JenkinsRule.WebClient wc, String fromName, St @Issue("JENKINS-58282") @Test public void shouldHaveHealthMetricConfiguredGloballyOnCreation() throws Exception { assertThat("by default, global configuration should have all folder health metrics", - AbstractFolderConfiguration.get().getHealthMetrics(), hasSize(FolderHealthMetricDescriptor.all().size())); + AbstractFolderConfiguration.get().getHealthMetrics(), hasSize((int) FolderHealthMetricDescriptor.all().stream().filter(d -> d.createDefault() != null).count())); Folder folder = r.jenkins.createProject(Folder.class, "myFolder"); DescribableList healthMetrics = folder.getHealthMetrics(); diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/config/AbstractFolderConfigurationTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/config/AbstractFolderConfigurationTest.java index 77e38386..81f673e5 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/config/AbstractFolderConfigurationTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/config/AbstractFolderConfigurationTest.java @@ -47,7 +47,7 @@ public void testInitialization() { @Test public void shouldBeAbleToRemoveHealthMetricConfiguredGlobally() throws Exception { assertThat("by default, global configuration should have all folder health metrics", - AbstractFolderConfiguration.get().getHealthMetrics(), hasSize(FolderHealthMetricDescriptor.all().size())); + AbstractFolderConfiguration.get().getHealthMetrics(), hasSize((int) FolderHealthMetricDescriptor.all().stream().filter(d -> d.createDefault() != null).count())); HtmlForm cfg = r.createWebClient().goTo("configure").getFormByName("config"); for (HtmlElement element : cfg.getElementsByAttribute("div", "name", "healthMetrics")) {