GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add `doesNot[Start/End]WithWhitespace` methods to `CharSequence` assertions by yyytir777 · Pull Request #3441 · assertj/assertj

Conversation

@yyytir777

@yyytir777 yyytir777 commented Apr 24, 2024

Copy link
Copy Markdown
Contributor

Check List:

  • Fixes Add AbstractCharSequenceAssert#doesNotHaveAny(Leading|Trailing)Whitespaces #3433
  • Unit tests : YES
  • Javadoc with a code example (on API only) : YES
  • PR meets the contributing guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yyytir777 and others added 4 commits April 24, 2024 13:53
@yyytir777
add doesNot[Start/End]WithWhitespace to CharSequenceAssert (Not Compl…
4dc5c87
…eted)
@yyytir777
Add doesNot[Start/End]WithWhitespace methods to AbstractCharSequenceA…
f86d876
…ssert class
@yyytir777
Merge branch 'assertj:3.x' into 3.x
4c76ce0
@yyytir777
add doesNot[Start/End]WithWhitespace to CharSequenceAssert
00ee76d
@onacit

onacit commented Apr 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Can't we use CharSequence#codePoints()?

Character.isWhiteapce(actual.codePoints().findFirst().getAsInt());
Character.isWhiteapce(actual.codePoints().reduce((v1, v2) -> v2).getAsInt());
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yyytir777
fix : remove 'public' from test class declaration
691d25a
@yyytir777

yyytir777 commented Apr 25, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for better method. I'll fix it right now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

yyytir777 and others added 2 commits April 25, 2024 16:25
@yyytir777
fix : use codePoints instead of char
2aab77f
@yyytir777
Merge branch 'assertj:3.x' into 3.x
ae7f5c4
@joel-costigliola

joel-costigliola commented May 1, 2024

Copy link
Copy Markdown
Member

@onacit why would using code points be better than char to detect whitespaces ?
do you have an example where using code points would detect whitespaces that char don't ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joel-costigliola
joel-costigliola self-requested a review May 1, 2024 22:39
@onacit

onacit commented May 2, 2024

Copy link
Copy Markdown
Contributor

@joel-costigliola As documented in Character.isWhitespace(char), it'll, I think, be better when we use codePoints.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the isWhitespace(int) method.

Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scordio

scordio commented May 2, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Can't we use CharSequence#codePoints()?

Character.isWhiteapce(actual.codePoints().findFirst().getAsInt());
Character.isWhiteapce(actual.codePoints().reduce((v1, v2) -> v2).getAsInt());

Best would be to compose a test that demonstrates the need for codePoints, for example using Unicode whitespace that wouldn't be detected by Character.isWhitespace(char) but would otherwise work with Character.isWhitespace(int).

The test would also prevent regressions if we changed the implementation to Character.isWhitespace(char).

Taking inspiration from https://stackoverflow.com/a/18169122/9714611, maybe a value from this list could help?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joel-costigliola

joel-costigliola commented May 2, 2024

Copy link
Copy Markdown
Member

I'm on it @scordio ! @yyytir777 you'll get full credit for the PR don't worry :)

scordio and yyytir777 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joel-costigliola

joel-costigliola commented May 3, 2024

Copy link
Copy Markdown
Member

Integrated thanks @yyytir777 !

yyytir777 reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joel-costigliola joel-costigliola closed this May 3, 2024
@scordio scordio changed the title Add doesNot[Start/End]WithWhitespace methods to AbstractCharSequenceAssert Add doesNot[Start/End]WithWhitespace methods to CharSequence assertions May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@joel-costigliola joel-costigliola Awaiting requested review from joel-costigliola

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add AbstractCharSequenceAssert#doesNotHaveAny(Leading|Trailing)Whitespaces

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@yyytir777 @onacit @joel-costigliola @scordio
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.