CCM NG: Updated EqualsVerifier to current version. Some tests need to be migrated.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4067 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
89c003b321
commit
1d5364bf7f
|
|
@ -43,6 +43,10 @@ public final class ConfigurationInfo {
|
||||||
*/
|
*/
|
||||||
private String descBundle;
|
private String descBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key for the localised title of the configuration class in the resource
|
||||||
|
* bundle.
|
||||||
|
*/
|
||||||
private String titleKey;
|
private String titleKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -99,7 +103,7 @@ public final class ConfigurationInfo {
|
||||||
public String getTitle(final Locale locale) {
|
public String getTitle(final Locale locale) {
|
||||||
return getDescriptionBundle(locale).getString(titleKey);
|
return getDescriptionBundle(locale).getString(titleKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription(final Locale locale) {
|
public String getDescription(final Locale locale) {
|
||||||
return getDescriptionBundle(locale).getString(descKey);
|
return getDescriptionBundle(locale).getString(descKey);
|
||||||
}
|
}
|
||||||
|
|
@ -121,6 +125,7 @@ public final class ConfigurationInfo {
|
||||||
int hash = 3;
|
int hash = 3;
|
||||||
hash = 59 * hash + Objects.hashCode(name);
|
hash = 59 * hash + Objects.hashCode(name);
|
||||||
hash = 59 * hash + Objects.hashCode(descBundle);
|
hash = 59 * hash + Objects.hashCode(descBundle);
|
||||||
|
hash = 59 * hash + Objects.hashCode(titleKey);
|
||||||
hash = 59 * hash + Objects.hashCode(descKey);
|
hash = 59 * hash + Objects.hashCode(descKey);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
@ -143,19 +148,26 @@ public final class ConfigurationInfo {
|
||||||
if (!Objects.equals(descBundle, other.getDescBundle())) {
|
if (!Objects.equals(descBundle, other.getDescBundle())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(titleKey, other.getTitleKey())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Objects.equals(descKey, other.getDescKey());
|
return Objects.equals(descKey, other.getDescKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s{ "
|
return String.format("%s{ "
|
||||||
+ "name = \"%s\", "
|
+ "name = \"%s\", "
|
||||||
+ "descBundle = \"%s\", "
|
+ "descBundle = \"%s\", "
|
||||||
+ "descKey = \"%s\""
|
+ "titleKey = \"%s\", "
|
||||||
+ " }",
|
+ "descKey = \"%s\""
|
||||||
|
+ " }",
|
||||||
super.toString(),
|
super.toString(),
|
||||||
name,
|
name,
|
||||||
descBundle,
|
descBundle,
|
||||||
|
titleKey,
|
||||||
descKey);
|
descKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.security.Group;
|
import org.libreccm.security.Group;
|
||||||
import org.libreccm.security.Permission;
|
|
||||||
import org.libreccm.security.Role;
|
import org.libreccm.security.Role;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
|
|
@ -108,6 +107,7 @@ public class EqualsAndHashCodeTest {
|
||||||
.forClass(entityClass)
|
.forClass(entityClass)
|
||||||
.suppress(Warning.STRICT_INHERITANCE)
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
.suppress(Warning.NONFINAL_FIELDS)
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
|
.suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
|
||||||
.withRedefinedSuperclass()
|
.withRedefinedSuperclass()
|
||||||
.withPrefabValues(Category.class, category1, category2)
|
.withPrefabValues(Category.class, category1, category2)
|
||||||
.withPrefabValues(Domain.class, domain1, domain2)
|
.withPrefabValues(Domain.class, domain1, domain2)
|
||||||
|
|
@ -119,6 +119,10 @@ public class EqualsAndHashCodeTest {
|
||||||
.verify();
|
.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link User} has a protected constructor, so have have do this to create
|
||||||
|
* users for the test...
|
||||||
|
*/
|
||||||
private class TestUser extends User {
|
private class TestUser extends User {
|
||||||
|
|
||||||
private static final long serialVersionUID = -9052762220990453621L;
|
private static final long serialVersionUID = -9052762220990453621L;
|
||||||
|
|
|
||||||
|
|
@ -18,42 +18,103 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||||
|
import nl.jqno.equalsverifier.Warning;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.libreccm.categorization.Category;
|
||||||
|
import org.libreccm.categorization.Domain;
|
||||||
|
import org.libreccm.security.Group;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@Category(UnitTest.class)
|
@org.junit.experimental.categories.Category(UnitTest.class)
|
||||||
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
public class EqualsAndHashCodeTest {
|
||||||
|
|
||||||
|
private final Class<?> entityClass;
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
@Parameterized.Parameters(name = "{0}")
|
||||||
public static Collection<Class<?>> data() {
|
public static Collection<Class<?>> data() {
|
||||||
return Arrays.asList(new Class<?>[]{
|
return Arrays.asList(new Class<?>[]{
|
||||||
CcmObject.class,
|
CcmObject.class,
|
||||||
EmailAddress.class,
|
EmailAddress.class,});
|
||||||
// GroupMembership.class,
|
|
||||||
// Subject.class,
|
|
||||||
// Permission.class,
|
|
||||||
// PersonName.class,
|
|
||||||
// Privilege.class,
|
|
||||||
ResourceType.class,
|
|
||||||
// Role.class,
|
|
||||||
// User.class,
|
|
||||||
// Group.class
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EqualsAndHashCodeTest(final Class<?> entityClass) {
|
public EqualsAndHashCodeTest(final Class<?> entityClass) {
|
||||||
super(entityClass);
|
this.entityClass = entityClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void verifyEqualsAndHashCode() {
|
||||||
|
|
||||||
|
final CcmObject ccmObject1 = new CcmObject();
|
||||||
|
ccmObject1.setObjectId(-100);
|
||||||
|
ccmObject1.setDisplayName("Object 1");
|
||||||
|
|
||||||
|
final CcmObject ccmObject2 = new CcmObject();
|
||||||
|
ccmObject1.setObjectId(-200);
|
||||||
|
ccmObject1.setDisplayName("Object 2");
|
||||||
|
|
||||||
|
final Role role1 = new Role();
|
||||||
|
role1.setName("role1");
|
||||||
|
|
||||||
|
final Role role2 = new Role();
|
||||||
|
role2.setName("role2");
|
||||||
|
|
||||||
|
final Group group1 = new Group();
|
||||||
|
group1.setName("group1");
|
||||||
|
|
||||||
|
final Group group2 = new Group();
|
||||||
|
group2.setName("group2");
|
||||||
|
|
||||||
|
final User user1 = new TestUser();
|
||||||
|
user1.setName("user1");
|
||||||
|
|
||||||
|
final User user2 = new TestUser();
|
||||||
|
user2.setName("user2");
|
||||||
|
|
||||||
|
final Category category1 = new Category();
|
||||||
|
category1.setName("Category One");
|
||||||
|
|
||||||
|
final Category category2 = new Category();
|
||||||
|
category2.setName("Category Two");
|
||||||
|
|
||||||
|
EqualsVerifier
|
||||||
|
.forClass(entityClass)
|
||||||
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
|
.suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
|
||||||
|
.withRedefinedSuperclass()
|
||||||
|
.withPrefabValues(CcmObject.class, ccmObject1, ccmObject2)
|
||||||
|
.withPrefabValues(Role.class, role1, role2)
|
||||||
|
.withPrefabValues(Group.class, group1, group2)
|
||||||
|
.withPrefabValues(User.class, user1, user2)
|
||||||
|
.withPrefabValues(Category.class, category1, category2)
|
||||||
|
.verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link User} has a protected constructor, so have have do this to create
|
||||||
|
* users for the test...
|
||||||
|
*/
|
||||||
|
private class TestUser extends User {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -9052762220990453621L;
|
||||||
|
|
||||||
|
protected TestUser() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,38 +64,39 @@ public class EqualsAndHashCodeTest {
|
||||||
public void verifyEqualsAndHashCode() {
|
public void verifyEqualsAndHashCode() {
|
||||||
final Component component1 = new Component();
|
final Component component1 = new Component();
|
||||||
component1.setAdminName("Component One");
|
component1.setAdminName("Component One");
|
||||||
|
|
||||||
final Component component2 = new Component();
|
final Component component2 = new Component();
|
||||||
component2.setAdminName("Component Two");
|
component2.setAdminName("Component Two");
|
||||||
|
|
||||||
final WidgetLabel widgetLabel1 = new WidgetLabel();
|
final WidgetLabel widgetLabel1 = new WidgetLabel();
|
||||||
widgetLabel1.setAdminName("WidgetLabel One");
|
widgetLabel1.setAdminName("WidgetLabel One");
|
||||||
|
|
||||||
final WidgetLabel widgetLabel2 = new WidgetLabel();
|
final WidgetLabel widgetLabel2 = new WidgetLabel();
|
||||||
widgetLabel2.setAdminName("WidgetLabel Two");
|
widgetLabel2.setAdminName("WidgetLabel Two");
|
||||||
|
|
||||||
final Widget widget1 = new Widget();
|
final Widget widget1 = new Widget();
|
||||||
widget1.setAdminName("Widget 1");
|
widget1.setAdminName("Widget 1");
|
||||||
|
|
||||||
final Widget widget2 = new Widget();
|
final Widget widget2 = new Widget();
|
||||||
widget2.setAdminName("Widget 2");
|
widget2.setAdminName("Widget 2");
|
||||||
|
|
||||||
final FormSection formSection1 = new FormSection();
|
final FormSection formSection1 = new FormSection();
|
||||||
formSection1.setAdminName("FormSection One");
|
formSection1.setAdminName("FormSection One");
|
||||||
|
|
||||||
final FormSection formSection2 = new FormSection();
|
final FormSection formSection2 = new FormSection();
|
||||||
formSection2.setAdminName("FormSection Two");
|
formSection2.setAdminName("FormSection Two");
|
||||||
|
|
||||||
EqualsVerifier
|
EqualsVerifier
|
||||||
.forClass(entityClass)
|
.forClass(entityClass)
|
||||||
.suppress(Warning.STRICT_INHERITANCE)
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
.suppress(Warning.NONFINAL_FIELDS)
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
.withRedefinedSuperclass()
|
.suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
|
||||||
.withPrefabValues(Component.class, component1, component2)
|
.withRedefinedSuperclass()
|
||||||
.withPrefabValues(WidgetLabel.class, widgetLabel1, widgetLabel2)
|
.withPrefabValues(Component.class, component1, component2)
|
||||||
.withPrefabValues(Widget.class, widget1, widget2)
|
.withPrefabValues(WidgetLabel.class, widgetLabel1, widgetLabel2)
|
||||||
.withPrefabValues(FormSection.class, formSection1, formSection2)
|
.withPrefabValues(Widget.class, widget1, widget2)
|
||||||
.verify();
|
.withPrefabValues(FormSection.class, formSection1, formSection2)
|
||||||
|
.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.formbuilder.actions;
|
||||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||||
import nl.jqno.equalsverifier.Warning;
|
import nl.jqno.equalsverifier.Warning;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.formbuilder.Component;
|
import org.libreccm.formbuilder.Component;
|
||||||
|
|
@ -30,13 +29,18 @@ import org.libreccm.tests.categories.UnitTest;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.libreccm.categorization.Category;
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
import org.libreccm.security.Group;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@Category(UnitTest.class)
|
@org.junit.experimental.categories.Category(UnitTest.class)
|
||||||
public class EqualsAndHashCodeTest {
|
public class EqualsAndHashCodeTest {
|
||||||
|
|
||||||
private final Class<?> entityClass;
|
private final Class<?> entityClass;
|
||||||
|
|
@ -61,24 +65,76 @@ public class EqualsAndHashCodeTest {
|
||||||
public void verifyEqualsAndHashCode() {
|
public void verifyEqualsAndHashCode() {
|
||||||
final Component component1 = new Component();
|
final Component component1 = new Component();
|
||||||
component1.setAdminName("Component One");
|
component1.setAdminName("Component One");
|
||||||
|
|
||||||
final Component component2 = new Component();
|
final Component component2 = new Component();
|
||||||
component2.setAdminName("Component Two");
|
component2.setAdminName("Component Two");
|
||||||
|
|
||||||
final FormSection formSection1 = new FormSection();
|
final FormSection formSection1 = new FormSection();
|
||||||
formSection1.setAdminName("FormSection One");
|
formSection1.setAdminName("FormSection One");
|
||||||
|
|
||||||
final FormSection formSection2 = new FormSection();
|
final FormSection formSection2 = new FormSection();
|
||||||
formSection2.setAdminName("FormSection Two");
|
formSection2.setAdminName("FormSection Two");
|
||||||
|
|
||||||
|
final CcmObject ccmObject1 = new CcmObject();
|
||||||
|
ccmObject1.setObjectId(-100);
|
||||||
|
ccmObject1.setDisplayName("Object 1");
|
||||||
|
|
||||||
|
final CcmObject ccmObject2 = new CcmObject();
|
||||||
|
ccmObject1.setObjectId(-200);
|
||||||
|
ccmObject1.setDisplayName("Object 2");
|
||||||
|
|
||||||
|
final Role role1 = new Role();
|
||||||
|
role1.setName("role1");
|
||||||
|
|
||||||
|
final Role role2 = new Role();
|
||||||
|
role2.setName("role2");
|
||||||
|
|
||||||
|
final Group group1 = new Group();
|
||||||
|
group1.setName("group1");
|
||||||
|
|
||||||
|
final Group group2 = new Group();
|
||||||
|
group2.setName("group2");
|
||||||
|
|
||||||
|
final User user1 = new TestUser();
|
||||||
|
user1.setName("user1");
|
||||||
|
|
||||||
|
final User user2 = new TestUser();
|
||||||
|
user2.setName("user2");
|
||||||
|
|
||||||
|
final Category category1 = new Category();
|
||||||
|
category1.setName("Category One");
|
||||||
|
|
||||||
|
final Category category2 = new Category();
|
||||||
|
category2.setName("Category Two");
|
||||||
|
|
||||||
EqualsVerifier
|
EqualsVerifier
|
||||||
.forClass(entityClass)
|
.forClass(entityClass)
|
||||||
.suppress(Warning.STRICT_INHERITANCE)
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
.suppress(Warning.NONFINAL_FIELDS)
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
.withRedefinedSuperclass()
|
.suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
|
||||||
.withPrefabValues(Component.class, component1, component2)
|
.withRedefinedSuperclass()
|
||||||
.withPrefabValues(FormSection.class, formSection1, formSection2)
|
.withPrefabValues(Component.class, component1, component2)
|
||||||
.verify();
|
.withPrefabValues(FormSection.class, formSection1, formSection2)
|
||||||
|
.withPrefabValues(CcmObject.class, ccmObject1, ccmObject2)
|
||||||
|
.withPrefabValues(Role.class, role1, role2)
|
||||||
|
.withPrefabValues(Group.class, group1, group2)
|
||||||
|
.withPrefabValues(User.class, user1, user2)
|
||||||
|
.withPrefabValues(Category.class, category1, category2)
|
||||||
|
.verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link User} has a protected constructor, so have have do this to create
|
||||||
|
* users for the test...
|
||||||
|
*/
|
||||||
|
private class TestUser extends User {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -9052762220990453621L;
|
||||||
|
|
||||||
|
protected TestUser() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,47 +23,48 @@ import org.junit.Test;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class for verifying the implementations of the {@code equals()}
|
* A base class for verifying the implementations of the {@code equals()} and
|
||||||
* and {@code hashCode} methods of an object using the {@link Parameterized}
|
* {@code hashCode} methods of an object using the {@link Parameterized} test
|
||||||
* test runner from JUnit.
|
* runner from JUnit.
|
||||||
*
|
*
|
||||||
* To use this class create a new JUnit test class which extends this class
|
* To use this class create a new JUnit test class which extends this class and
|
||||||
* and which uses the {@link Parameterized} test runner. The class must have a
|
* which uses the {@link Parameterized} test runner. The class must have a
|
||||||
* static method which provides the classes to be tested. Example for testing
|
* static method which provides the classes to be tested. Example for testing
|
||||||
* the classes {@code Foo} and {@code Bar} (imports have been omitted):
|
* the classes {@code Foo} and {@code Bar} (imports have been omitted):
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <code>
|
* <code>
|
||||||
* @RunWith(Parameterized.class)
|
* @RunWith(Parameterized.class)
|
||||||
* @Category(UnitTest.class)
|
* @Category(UnitTest.class)
|
||||||
* public class FooBarTest extends EqualsVerifier {
|
* public class FooBarTest extends EqualsVerifier {
|
||||||
*
|
*
|
||||||
* @Parameterized.Parameters(name = "{0}")
|
* @Parameterized.Parameters(name = "{0}")
|
||||||
* public static Collection<Class<?>> data() {
|
* public static Collection<Class<?>> data() {
|
||||||
* return Arrays.asList(new Class<?>[] {
|
* return Arrays.asList(new Class<?>[] {
|
||||||
* Foo.class,
|
* Foo.class,
|
||||||
* Bar.class
|
* Bar.class
|
||||||
* });
|
* });
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* public FooBarTest(final Class<?> entityClass) {
|
* public FooBarTest(final Class<?> entityClass) {
|
||||||
* super(entityClass);
|
* super(entityClass);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* An example in ccm-core is the
|
* An example in ccm-core is the
|
||||||
* <a href="../../../../../ccm-core/xref-test/org/libreccm/core/EqualsAndHashCodeTest.html"><code>EqualsAndHashCodeTest</code></a>
|
* <a href="../../../../../ccm-core/xref-test/org/libreccm/core/EqualsAndHashCodeTest.html"><code>EqualsAndHashCodeTest</code></a>
|
||||||
* in the {@code org.libreccm.core} package.
|
* in the {@code org.libreccm.core} package.
|
||||||
*
|
*
|
||||||
* For testing {@code equals} and {@code hashCode} this class uses the
|
* For testing {@code equals} and {@code hashCode} this class uses the
|
||||||
* <a href="EqualsVerifier">http://www.jqno.nl/equalsverifier/</a> utility. If
|
* <a href="EqualsVerifier">http://www.jqno.nl/equalsverifier/</a> utility. If
|
||||||
* the classes to verify are part of complex inheritance hierarchy you may need
|
* the classes to verify are part of complex inheritance hierarchy you may need
|
||||||
* to create your own test using the {@code EqualsVerifier}. An example in
|
* to create your own test using the {@code EqualsVerifier}. An example in
|
||||||
* ccm-core is the <a href="../../../../../ccm-core/xref-test/org/libreccm/core/ResourceEntityTest.html"><code>ResourceEntityTest</code></a>
|
* ccm-core is the
|
||||||
|
* <a href="../../../../../ccm-core/xref-test/org/libreccm/core/ResourceEntityTest.html"><code>ResourceEntityTest</code></a>
|
||||||
* in the {@code org.libreccm.core} package.
|
* in the {@code org.libreccm.core} package.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class EqualsVerifier {
|
public class EqualsVerifier {
|
||||||
|
|
@ -77,10 +78,11 @@ public class EqualsVerifier {
|
||||||
@Test
|
@Test
|
||||||
public void verifyEqualsAndHashCode() {
|
public void verifyEqualsAndHashCode() {
|
||||||
nl.jqno.equalsverifier.EqualsVerifier
|
nl.jqno.equalsverifier.EqualsVerifier
|
||||||
.forClass(entityClass)
|
.forClass(entityClass)
|
||||||
.suppress(Warning.STRICT_INHERITANCE)
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
.suppress(Warning.NONFINAL_FIELDS)
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
.withRedefinedSuperclass()
|
.suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
|
||||||
.verify();
|
.withRedefinedSuperclass()
|
||||||
|
.verify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
pom.xml
3
pom.xml
|
|
@ -542,7 +542,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.jqno.equalsverifier</groupId>
|
<groupId>nl.jqno.equalsverifier</groupId>
|
||||||
<artifactId>equalsverifier</artifactId>
|
<artifactId>equalsverifier</artifactId>
|
||||||
<version>1.7.8</version>
|
<!--<version>1.7.8</version>-->
|
||||||
|
<version>2.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- h2 database in used to check some database related things -->
|
<!-- h2 database in used to check some database related things -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue