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

Add AbstractClassAssert#is(Not)Primitive() #2717

Closed
onacit opened this issue Jul 27, 2022 · 6 comments
Closed

Add AbstractClassAssert#is(Not)Primitive() #2717

onacit opened this issue Jul 27, 2022 · 6 comments
Assignees
Labels
status: ideal for contribution An issue that a contributor can help us with type: improvement A general improvement
Milestone

Comments

@onacit
Copy link
Contributor

onacit commented Jul 27, 2022

Feature summary

The AbstractClassAssert lacks with is(Not)Primitive().

Example

assertThat(int.class).isPrimitive();
assertThat(String.class).isNotPrimitive();

There is already workarounds for the case, I know.

assertThat(c.isPrimitive()).isTrue();

I just found a case regarding the .as(...).

for (Field file : findSomeSpecificFields()) {
    assertThat(field.getType().isPrimitive())
        .as("@NullableBySpecification on primitive field: %s", field)
        .isFalse();
}

which may be more fluent,

for (Field file : findSomeSpecificFields()) {
    assertThat(field.getType())
        .as("%s annotated with @NullableBySpecification, field)
        .isNotPrimitive();
    //  '...Class#field annotated with @NullableBySpecification should not be primitive.
}
@joel-costigliola
Copy link
Member

Fine by me!

@joel-costigliola joel-costigliola added the status: ideal for contribution An issue that a contributor can help us with label Jul 27, 2022
@ManuelG28
Copy link

Hi @joel-costigliola
Could I take this one? 😃

@scordio
Copy link
Member

scordio commented Jul 28, 2022

Go for it, @ManuelG28!

@onacit
Copy link
Contributor Author

onacit commented Sep 16, 2023

Oh. I just found myself, again, expecting assertThat(clazz).isPrimitive().
@ManuelG28 Is your PR still working in progress?

@scordio
Copy link
Member

scordio commented Sep 16, 2023

Sorry, #2722 slipped under our radar.

I've added it to 3.25.0.

@joel-costigliola
Copy link
Member

joel-costigliola commented Sep 30, 2023

Done in 98e3acd.

@scordio scordio added this to the 3.25.0 milestone Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal for contribution An issue that a contributor can help us with type: improvement A general improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants