Skip to content

classes implement should respect interface extends #1482

@xenoterracide

Description

@xenoterracide

I have

@Value.Immutable
@ValueObject
public interface MyId extends Identifier {
}

and I want to validate

classes().that().implement(Identifier.class).should().haveSimpleNameEndingWith("Id")

even if we agree this is not the right code, I don't see any way to validate the interface. Given I'm using the immutables library, this seems the correct placing.

Additionally, I tried creating an @ImmutableValueObject and annotate it with @ValueObject using immutables @InjectAnnotation and it seems there isn't any way to validate that the annotation exists if it's a composed annotation.

lastly it'd be nice to be able to say something here like

classes().that().implement(Identifier.class).should().haveSimpleNameEndingWith("Id").reflexively()

which would imply

classes().that().implement(Identifier.class).should().haveSimpleNameEndingWith("Id")
classes().that().haveSimpleNameEndingWith("Id").should().implement(Identifier.class)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions