Skip to content

Commit

Permalink
jqno#232: fixes NPE when verifying interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Feb 18, 2019
1 parent 58cfd57 commit e930d56
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Fixed
- Verifying interfaces directly causes NullPointerException. ([Issue 232](/~https://github.com/jqno/equalsverifier/issues/232))
- Improved error messages regarding JPA's `@EmbeddedId` annotation. ([Issue 231](/~https://github.com/jqno/equalsverifier/issues/231))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private String buildErrorMessage(String description) {
}

private void performVerification() {
if (type.isEnum()) {
if (type.isEnum() || type.isInterface()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package nl.jqno.equalsverifier.integration.extended_contract;

import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.Test;

public class InterfaceTest {
@Test
public void succeed_whenClassIsAnInterface() {
EqualsVerifier.forClass(CharSequence.class)
.verify();
}

@Test
public void succeed_whenClassIsAnEmptyInterface() {
EqualsVerifier.forClass(Interface.class)
.verify();
}

interface Interface {}
}

0 comments on commit e930d56

Please sign in to comment.