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 hasPermittedSubclasses for Class assertions by pbacz · Pull Request #3316 · assertj/assertj

Conversation

@pbacz

@pbacz pbacz commented Jan 2, 2024

Copy link
Copy Markdown
Contributor

Check List:

  • Fixes hasPermittedSubclasses and hasNoPermittedSubclasses for Class assertions #3263
  • 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
@scordio scordio added this to the 3.26.0 milestone Jan 2, 2024
@pbacz
pbacz force-pushed the issue-3263 branch from 7232dc5 to 4dbddc5 Compare January 2, 2024 16:26
scordio
scordio reviewed Jan 3, 2024
View reviewed changes

@scordio scordio left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @pbacz! I have a few comments.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread assertj-core/src/main/java/org/assertj/core/api/AbstractClassAssert.java Outdated
* @throws AssertionError if {@code actual} is {@code null}.
* @throws AssertionError if the actual {@code Class} has any permitted subclasses
*/
public SELF hasNoPermittedSubclasses() {

@scordio scordio Jan 3, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the impression it's not valuable to have this assertion (#3263 (comment)).

Or did I misunderstand?

Sorry, something went wrong.

Uh oh!

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

All reactions

@pbacz pbacz Jan 3, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I misunderstood. When you said:

I propose we add only hasPermittedSubclasses with contains behavior

I thought you mean add hasPermittedSubclasses and do not add hasOnlyPermittedSubclasses.

I can remove this assertion, no problem.

Sorry, something went wrong.

Uh oh!

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

scordio reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread assertj-core/src/main/java/org/assertj/core/internal/Classes.java Outdated
* @throws AssertionError if {@code actual} is {@code null}.
* @throws AssertionError if the actual {@code Class} does not have all of these permitted subclasses.
*/
public void assertContainsPermittedSubclasses(AssertionInfo info, Class<?> actual,

@scordio scordio Jan 3, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be pulled to AbstractClassAssert as a private method as it's unlikely we would reuse this elsewhere. hasSuperclass implementation might be a good example of such a pattern.

Sorry, something went wrong.

Uh oh!

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

pbacz reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@pbacz pbacz Jan 3, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do.

Sorry, something went wrong.

Uh oh!

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

All reactions

@pbacz pbacz Jan 3, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...va-17/src/test/java/org/assertj/core/tests/java17/Assertions_assertThat_with_Class_Test.java Resolved

Uh oh!

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

@pbacz

pbacz commented Jan 3, 2024

Copy link
Copy Markdown
Contributor Author

@scordio I need this commit in my branch 887f97b
Which approach is recommended in the project?

  • rebase over main
  • merge main to my branch
  • cherry pick the commit
All reactions

Sorry, something went wrong.

Uh oh!

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

@scordio

scordio commented Jan 3, 2024

Copy link
Copy Markdown
Member

I'd suggest either rebase or merge but it's totally up to you.

We'll anyway squash the changes in a single commit once ready.

pbacz reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

pbacz and others added 6 commits January 3, 2024 23:20
@pbacz
Add hasPermittedSubclasses and hasNoPermittedSubclasses for Class ass…
1f3ee49
…ertions
@pbacz
Change variable name
479c400
@pbacz
Update license headers
bfa5f35
@pbacz @scordio
Update assertj-tests/assertj-integration-tests/assertj-core-java-17/s…
0cbbaf4
…rc/test/java/org/assertj/core/tests/java17/Assertions_assertThat_with_Class_Test.java

Co-authored-by: Stefano Cordio <[email protected]>
@pbacz @scordio
Update assertj-tests/assertj-integration-tests/assertj-core-java-17/s…
62f30c9
…rc/test/java/org/assertj/core/tests/java17/Assertions_assertThat_with_Class_Test.java

Co-authored-by: Stefano Cordio <[email protected]>
@pbacz
Remove hasNoPermittedSuperclass() assertion
b122624
@pbacz
pbacz force-pushed the issue-3263 branch from 887770e to b122624 Compare January 3, 2024 22:39
@pbacz
Move implementation of hasPermittedSubclasses from Classes to Abstrac…
c806847
…tClassAssert
@pbacz pbacz changed the title Add hasPermittedSubclasses and hasNoPermittedSubclasses for Class assertions Add hasPermittedSubclasses for Class assertions Jan 4, 2024
@joel-costigliola
joel-costigliola self-requested a review May 12, 2024 22:09
@joel-costigliola joel-costigliola self-assigned this May 12, 2024
@joel-costigliola

joel-costigliola commented May 14, 2024

Copy link
Copy Markdown
Member

Integrated thanks @pbacz!

All reactions

Sorry, something went wrong.

Uh oh!

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

@joel-costigliola joel-costigliola closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@scordio scordio scordio left review comments
@joel-costigliola joel-costigliola Awaiting requested review from joel-costigliola

Uh oh!

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

Assignees

@joel-costigliola joel-costigliola

Labels

None yet

Projects

None yet

Milestone

3.26.0

Development

Successfully merging this pull request may close these issues.

hasPermittedSubclasses and hasNoPermittedSubclasses for Class assertions

Uh oh!

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

3 participants

@pbacz @scordio @joel-costigliola
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.