Skip to content

Conversation

Copy link

Copilot AI commented Oct 2, 2025

  • Add assertThrows import from JUnit Jupiter
  • Convert testListener method to use assertThrows instead of try-catch when exception is expected
  • Convert testStyleRangeSegmenting method to remove unnecessary exception handling
  • Simplify assertThrows usage - cleanup code now outside assertThrows lambda
  • Ensure listener is always removed by placing cleanup in finally block
  • Verify the changes compile and tests pass
Original prompt

Convert Test_org_eclipse_swt_custom_BidiSegmentListener.java to use assertThrows instead of custom try-catch blocks


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@laeubi
Copy link
Contributor

laeubi commented Oct 2, 2025

@copilot also look at preliminary work for a similar example by @akurtakov here #2579

Copilot AI changed the title [WIP] Convert Test_org_eclipse_swt_custom_BidiSegmentListener.java to use assertThrows instead of custom try-catch blocks Convert Test_org_eclipse_swt_custom_BidiSegmentListener to use assertThrows instead of try-catch blocks Oct 2, 2025
Copilot AI requested a review from laeubi October 2, 2025 08:13
Copilot finished work on behalf of laeubi October 2, 2025 08:13
Copy link
Author

Copilot AI commented Oct 2, 2025

@copilot also look at preliminary work for a similar example by @akurtakov here #2579

Simplified the assertThrows usage following the pattern from PR #2579. The cleanup code is now outside the assertThrows lambda, making it cleaner and more straightforward (commit 582b0ab).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/eclipse-platform/eclipse.platform.swt/pulls/2579
    • Triggering command: curl -s -H Accept: application/vnd.github.v3+json REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of laeubi October 2, 2025 08:17
@akurtakov
Copy link
Member

@copilot Ensure text.removeBidiSegmentListener is always called by putting it in finally block

@laeubi
Copy link
Contributor

laeubi commented Oct 2, 2025

@copilot please consider the remark from @akurtakov here #2580 (comment)

Copy link
Author

Copilot AI commented Oct 2, 2025

@copilot please consider the remark from @akurtakov here #2580 (comment)

Applied the suggestion - the listener cleanup is now in a finally block (commit 0bb8226).

@copilot Ensure text.removeBidiSegmentListener is always called by putting it in finally block

Wrapped the test code in try-finally to ensure the listener is always removed, even if an exception or assertion failure occurs (commit 0bb8226).

Copilot finished work on behalf of laeubi October 2, 2025 08:33
@akurtakov akurtakov force-pushed the copilot/fix-3cc6aac9-23ad-4eea-8001-27c2cc0a400c branch from 0bb8226 to f5bd827 Compare October 17, 2025 07:45
@github-actions
Copy link
Contributor

Test Results

  108 files   -  7    108 suites   - 7   12m 59s ⏱️ -7s
4 498 tests  - 56  4 484 ✅  - 54  13 💤  - 3  0 ❌ ±0  1 🔥 +1 
  255 runs   - 56    255 ✅  - 53   0 💤  - 3  0 ❌ ±0 

For more details on these errors, see this check.

Results for commit f5bd827. ± Comparison against base commit ac18a18.

This pull request removes 56 tests.
AllWin32Tests ImageWin32Tests ‑ testDisposeDrawnImageBeforeRequestingTargetForOtherZoom
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ testImageDataForDifferentFractionalZoomsShouldBeDifferent
AllWin32Tests ImageWin32Tests ‑ testImageShouldHaveDimesionAsPerZoomLevel
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromCopiedImage
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromImageForImageDataFromImage
AllWin32Tests TestTreeColumn ‑ test_ColumnOrder
…

@akurtakov
Copy link
Member

Closing in favor of #2642

@akurtakov akurtakov closed this Oct 17, 2025
@akurtakov akurtakov deleted the copilot/fix-3cc6aac9-23ad-4eea-8001-27c2cc0a400c branch October 17, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants