From 26d36507b4a74757609a089ef0c86df7cbf6a914 Mon Sep 17 00:00:00 2001 From: fjeanne Date: Wed, 27 Mar 2024 06:17:11 +0100 Subject: [PATCH] Fix tests in LaunchConfigurationTabGroupViewerTest #1075 - Remove invalid usages of java.util.function.Predicate.not - Change assertions in testOnlyDefaultTabInOtherConfigIsActivated and reactivate the test - Replace calls to assertj's "matches" method with calls to isTrue/isFalse to improve readability (also, some calls were wrong) Fixes https://github.com/eclipse-platform/eclipse.platform/issues/1075 --- ...LaunchConfigurationTabGroupViewerTest.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/LaunchConfigurationTabGroupViewerTest.java b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/LaunchConfigurationTabGroupViewerTest.java index 6e4176b2540..a2d8fb1b02f 100644 --- a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/LaunchConfigurationTabGroupViewerTest.java +++ b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/LaunchConfigurationTabGroupViewerTest.java @@ -11,7 +11,6 @@ package org.eclipse.debug.tests.ui; -import static java.util.function.Predicate.not; import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; @@ -31,7 +30,6 @@ import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import org.eclipse.swt.widgets.Display; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; public class LaunchConfigurationTabGroupViewerTest { @@ -71,7 +69,7 @@ public void testAllTabsAreInitializedByDefault() { final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig); for (int i = 0; i < tabs.length; i++) { - assertThat(((SpyTab) tabs[i])).withFailMessage("tab %s was not initialized", i).matches(SpyTab::isInitialized); + assertThat(((SpyTab) tabs[i]).isInitialized()).withFailMessage("tab %s was not initialized", i).isTrue(); } } @@ -83,7 +81,7 @@ public void testFirstTabIsActivatedByDefault() { }; final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig); - assertThat(((SpyTab) tabs[0])).matches(SpyTab::isActivated, "is activated"); + assertThat(((SpyTab) tabs[0]).isActivated()).withFailMessage("tab was not activated").isTrue(); } @Test @@ -104,12 +102,11 @@ public void testOtherTabInOtherConfigIsActivated() { final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab); - assertThat((SpyTab) tabs[0]).withFailMessage("the 1st tab of the other launch configuration shouldn't have been activated").matches(not(SpyTab::isActivated)); - assertThat((SpyTab) tabs[secondTabIndex]).matches(SpyTab::isActivated, "is activated"); + assertThat(((SpyTab) tabs[0]).isActivated()).withFailMessage("the 1st tab of the other launch configuration shouldn't have been activated").isFalse(); + assertThat(((SpyTab) tabs[secondTabIndex]).isActivated()).withFailMessage("the other tab of the other launch configuration should have been activated").isTrue(); } @Test - @Ignore("https://github.com/eclipse-platform/eclipse.platform/issues/1075") public void testOnlyDefaultTabInOtherConfigIsActivated() { int overflowTabIndex = Integer.MAX_VALUE; @@ -127,11 +124,11 @@ public void testOnlyDefaultTabInOtherConfigIsActivated() { final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab); - assertThat(((SpyTab) tabs[0])).withFailMessage("the 1st tab of the other launch configuration should have been activated").matches(SpyTab::isActivated); + assertThat(((SpyTab) tabs[0]).isActivated()).withFailMessage("the 1st tab of the other launch configuration should have been activated").isTrue(); - // All other tabs should not have been initialized + // All other tabs should not have been activated for (int i = 1; i < tabs.length; i++) { - assertThat((SpyTab) tabs[i]).withFailMessage("tab %s should not have been initialized", i).matches(not(SpyTab::isInitialized)); + assertThat(((SpyTab) tabs[i]).isActivated()).withFailMessage("tab %s should not have been activated", i).isFalse(); } } @@ -149,7 +146,7 @@ public void testOtherTabIsActivated() { final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab); - assertThat((SpyTab) tabs[secondTabIndex]).matches(SpyTab::isActivated, "is activated"); + assertThat(((SpyTab) tabs[secondTabIndex]).isActivated()).withFailMessage("tab %s should have been activated", secondTabIndex).isTrue(); } private ILaunchConfigurationWorkingCopy createLaunchConfigurationInstance() throws CoreException {