Skip to content

Add an assertion for checking a class package #1947

@polarene

Description

@polarene

Summary

I'm working on a code generation module and I need to check that generated classes have the right package.
Currently, this is the best AssertJ lets me express:

Class<?> aClass;
String packageName;

assertThat(aClass.getPackageName()).isEqualTo(packageName);

I would like a more expressive assertion such as:

Example

assertThat(aClass).hasPackage(packageName);

There could be an overload for a Package argument as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions