Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silently failing LaunchConfigurationTabGroupViewerTest#testOnlyDefaultTabInOtherConfigIsActivated #1075

Closed
HeikoKlare opened this issue Jan 5, 2024 · 0 comments · Fixed by #1268
Assignees
Labels
help wanted Extra attention is needed regression Regression defect test junit test related things

Comments

@HeikoKlare
Copy link
Contributor

Two test cases added with #860 are broken:

  • LaunchConfigurationTabGroupViewerTest#testOnlyDefaultTabInOtherConfigIsActivated()
  • LaunchConfigurationTabGroupViewerTest#testOtherTabInOtherConfigIsActivated()

They make false use of the not matcher from hamcrest, e.g.:

assertThat("Tab " + i + " should not have been initialized", not(((SpyTab) tabs[i]).isInitialized()));

The test class erroneously imports AssertJ's assertThat to which passing a matcher object is valid (other than to Hamcrests assertThat), but AssertJ's assertThat does nothing if no actual assert method is called afterwards (such as isTrue() for a boolean assertion). Thus, the two assertions using not within this class do actually not assert anything.

In addition, one of the assertions, namely the one in LaunchConfigurationTabGroupViewerTest#testOnlyDefaultTabInOtherConfigIsActivated(), fails if it is corrected. The tabs are initialized although they are assumed to not have been initialized. So there is either a flaw in the test or some bug in the tested code.

A correction could look as follows:

assertThat((((SpyTab) tabs[i]).isInitialized())).describedAs("Tab " + i + " should not have been initialized").isFalse();
@HeikoKlare HeikoKlare added regression Regression defect test junit test related things labels Jan 5, 2024
@fedejeanne fedejeanne removed their assignment Jan 8, 2024
@fedejeanne fedejeanne added the help wanted Extra attention is needed label Jan 8, 2024
@fedejeanne fedejeanne self-assigned this Mar 26, 2024
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this issue Mar 27, 2024


- 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 eclipse-platform#1075
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this issue Mar 27, 2024


- 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 eclipse-platform#1075
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this issue Mar 27, 2024


- Check for the activation (instead of the initialization) of other tabs
testOnlyDefaultTabInOtherConfigIsActivated and
reactivate the test.
- Provide meaningful toString() method for SpyTab to improve assertion
messages.
- Use extra parameter when calling the "matches" method to improve
readability

Fixes eclipse-platform#1075
HeikoKlare pushed a commit that referenced this issue Mar 27, 2024
- Check for the activation (instead of the initialization) of other tabs
testOnlyDefaultTabInOtherConfigIsActivated and
reactivate the test.
- Provide meaningful toString() method for SpyTab to improve assertion
messages.
- Use extra parameter when calling the "matches" method to improve
readability

Fixes #1075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed regression Regression defect test junit test related things
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants