CCM NG: All entity class of ccm-core pass tests for equals, hashCode and toString mehthods

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3455 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2015-06-03 20:19:37 +00:00
parent ce7f0a7e7b
commit a79c67974d
48 changed files with 788 additions and 235 deletions

View File

@ -158,7 +158,7 @@ public class Categorization implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Categorization)) {
return false; return false;
} }
final Categorization other = (Categorization) obj; final Categorization other = (Categorization) obj;

View File

@ -308,7 +308,7 @@ public class Category extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Category)) {
return false; return false;
} }
final Category other = (Category) obj; final Category other = (Category) obj;
@ -360,11 +360,11 @@ public class Category extends CcmObject implements Serializable {
+ "categoryOrder = %d%s", + "categoryOrder = %d%s",
uniqueId, uniqueId,
name, name,
title.toString(), Objects.toString(title),
enabled, enabled,
visible, visible,
abstractCategory, abstractCategory,
parentCategory, Objects.toString(parentCategory),
categoryOrder, categoryOrder,
data)); data));
} }

View File

@ -192,12 +192,20 @@ public class Domain extends CcmObject implements Serializable {
} }
public Date getReleased() { public Date getReleased() {
if (released == null) {
return null;
} else {
return new Date(released.getTime()); return new Date(released.getTime());
} }
}
public void setReleased(final Date released) { public void setReleased(final Date released) {
if (released == null) {
this.released = null;
} else {
this.released = new Date(released.getTime()); this.released = new Date(released.getTime());
} }
}
public Category getRoot() { public Category getRoot() {
return root; return root;
@ -213,6 +221,7 @@ public class Domain extends CcmObject implements Serializable {
* {@link DomainManager}. * {@link DomainManager}.
* *
* @return An <strong>unmodifiable</strong> list of the owners of this { * @return An <strong>unmodifiable</strong> list of the owners of this {
*
* @Domain} * @Domain}
* *
* @see #owners * @see #owners
@ -254,7 +263,7 @@ public class Domain extends CcmObject implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 3; int hash = super.hashCode();
hash = 41 * hash + Objects.hashCode(domainKey); hash = 41 * hash + Objects.hashCode(domainKey);
hash = 41 * hash + Objects.hashCode(uri); hash = 41 * hash + Objects.hashCode(uri);
hash = 41 * hash + Objects.hashCode(title); hash = 41 * hash + Objects.hashCode(title);
@ -271,10 +280,14 @@ public class Domain extends CcmObject implements Serializable {
"PMD.StdCyclomaticComplexity", "PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"}) "PMD.ModifiedCyclomaticComplexity"})
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (!super.equals(obj)) {
return false;
}
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Domain)) {
return false; return false;
} }
final Domain other = (Domain) obj; final Domain other = (Domain) obj;
@ -318,11 +331,11 @@ public class Domain extends CcmObject implements Serializable {
+ "released = %tF %<tT, " + "released = %tF %<tT, "
+ "root = \"%s\"%s", + "root = \"%s\"%s",
domainKey, domainKey,
uri.toString(), Objects.toString(uri),
title.toString(), Objects.toString(title),
version, version,
released, released,
root.toString(), Objects.toString(root),
data data
); );
} }

View File

@ -152,7 +152,7 @@ public class DomainOwnership implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof DomainOwnership)) {
return false; return false;
} }
final DomainOwnership other = (DomainOwnership) obj; final DomainOwnership other = (DomainOwnership) obj;
@ -199,8 +199,8 @@ public class DomainOwnership implements Serializable {
+ "%s }", + "%s }",
super.toString(), super.toString(),
ownershipId, ownershipId,
owner.toString(), Objects.toString(owner),
domain.toString(), Objects.toString(domain),
context, context,
domainOrder, domainOrder,
ownerOrder, ownerOrder,

View File

@ -163,7 +163,7 @@ public class Resource extends CcmObject implements Serializable {
// } // }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 5; int hash = super.hashCode();
hash = 29 * hash + Objects.hashCode(title); hash = 29 * hash + Objects.hashCode(title);
hash = 29 * hash + Objects.hashCode(description); hash = 29 * hash + Objects.hashCode(description);
hash = 29 * hash + Objects.hashCode(created); hash = 29 * hash + Objects.hashCode(created);
@ -176,11 +176,15 @@ public class Resource extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Resource)) { if (!(obj instanceof Resource)) {
return false; return false;
} }
final Resource other = (Resource) obj; final Resource other = (Resource) obj;
if (!other.canEqual(this)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -116,8 +116,12 @@ public class Component extends CcmObject implements Serializable {
} }
public List<Component> getChildComponents() { public List<Component> getChildComponents() {
if (childComponents == null) {
return null;
} else {
return Collections.unmodifiableList(childComponents); return Collections.unmodifiableList(childComponents);
} }
}
protected void setChildComponents(final List<Component> childComponents) { protected void setChildComponents(final List<Component> childComponents) {
this.childComponents = childComponents; this.childComponents = childComponents;
@ -158,7 +162,12 @@ public class Component extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Component)) {
return false; return false;
} }
final Component other = (Component) obj; final Component other = (Component) obj;

View File

@ -70,7 +70,12 @@ public class DataDrivenSelect extends Widget implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof DataDrivenSelect)) {
return false; return false;
} }
final DataDrivenSelect other = (DataDrivenSelect) obj; final DataDrivenSelect other = (DataDrivenSelect) obj;

View File

@ -18,8 +18,6 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import org.hibernate.annotations.CollectionId;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -89,7 +87,12 @@ public class FormSection extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FormSection)) {
return false; return false;
} }
final FormSection other = (FormSection) obj; final FormSection other = (FormSection) obj;

View File

@ -85,11 +85,16 @@ public class Listener extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Listener)) {
return false; return false;
} }
final Listener other = (Listener) obj; final Listener other = (Listener) obj;
if (other.canEqual(this)) { if (!other.canEqual(this)) {
return false; return false;
} }
@ -99,14 +104,11 @@ public class Listener extends CcmObject implements Serializable {
if (!Objects.equals(attributeString, other.getAttributeString())) { if (!Objects.equals(attributeString, other.getAttributeString())) {
return false; return false;
} }
if (!Objects.equals(widget, other.getWidget())) { return Objects.equals(widget, other.getWidget());
return false;
}
return true;
} }
@Override @Override
public boolean canEqual(Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof Listener; return obj instanceof Listener;
} }

View File

@ -96,7 +96,12 @@ public class MetaObject extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof MetaObject)) {
return false; return false;
} }
final MetaObject other = (MetaObject) obj; final MetaObject other = (MetaObject) obj;

View File

@ -61,7 +61,7 @@ public class ObjectType extends CcmObject implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 7; int hash = super.hashCode();
hash = 61 * hash + Objects.hashCode(appName); hash = 61 * hash + Objects.hashCode(appName);
hash = 61 * hash + Objects.hashCode(className); hash = 61 * hash + Objects.hashCode(className);
return hash; return hash;
@ -72,7 +72,12 @@ public class ObjectType extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ObjectType)) {
return false; return false;
} }
final ObjectType other = (ObjectType) obj; final ObjectType other = (ObjectType) obj;

View File

@ -80,7 +80,12 @@ public class Option extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Option)) {
return false; return false;
} }
final Option other = (Option) obj; final Option other = (Option) obj;

View File

@ -100,7 +100,12 @@ public class PersistentDataQuery extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof PersistentDataQuery)) {
return false; return false;
} }
final PersistentDataQuery other = (PersistentDataQuery) obj; final PersistentDataQuery other = (PersistentDataQuery) obj;

View File

@ -126,7 +126,12 @@ public class ProcessListener extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ProcessListener)) {
return false; return false;
} }
final ProcessListener other = (ProcessListener) obj; final ProcessListener other = (ProcessListener) obj;

View File

@ -18,7 +18,6 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -88,8 +87,12 @@ public class Widget extends Component implements Serializable {
} }
public List<Listener> getListeners() { public List<Listener> getListeners() {
if (listeners == null) {
return null;
} else {
return Collections.unmodifiableList(listeners); return Collections.unmodifiableList(listeners);
} }
}
protected void setListeners(final List<Listener> listeners) { protected void setListeners(final List<Listener> listeners) {
this.listeners = listeners; this.listeners = listeners;
@ -103,7 +106,6 @@ public class Widget extends Component implements Serializable {
listeners.remove(listener); listeners.remove(listener);
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
@ -120,7 +122,12 @@ public class Widget extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Widget)) {
return false; return false;
} }
final Widget other = (Widget) obj; final Widget other = (Widget) obj;
@ -144,6 +151,11 @@ public class Widget extends Component implements Serializable {
return Objects.equals(listeners, other.getListeners()); return Objects.equals(listeners, other.getListeners());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof Widget;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", parameterName = \"%s\", " return super.toString(String.format(", parameterName = \"%s\", "

View File

@ -59,7 +59,12 @@ public class WidgetLabel extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof WidgetLabel)) {
return false; return false;
} }
final WidgetLabel other = (WidgetLabel) obj; final WidgetLabel other = (WidgetLabel) obj;

View File

@ -73,7 +73,12 @@ public class ConfirmEmailListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ConfirmEmailListener)) {
return false; return false;
} }
final ConfirmEmailListener other = (ConfirmEmailListener) obj; final ConfirmEmailListener other = (ConfirmEmailListener) obj;

View File

@ -47,7 +47,12 @@ public class ConfirmRedirectListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ConfirmRedirectListener)) {
return false; return false;
} }
final ConfirmRedirectListener other = (ConfirmRedirectListener) obj; final ConfirmRedirectListener other = (ConfirmRedirectListener) obj;

View File

@ -45,7 +45,12 @@ public class RemoteServerPostListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof RemoteServerPostListener)) {
return false; return false;
} }
final RemoteServerPostListener other = (RemoteServerPostListener) obj; final RemoteServerPostListener other = (RemoteServerPostListener) obj;
@ -53,7 +58,12 @@ public class RemoteServerPostListener
return false; return false;
} }
return Objects.equals(this.remoteUrl, other.remoteUrl); return Objects.equals(this.remoteUrl, other.getRemoteUrl());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof RemoteServerPostListener;
} }
@Override @Override

View File

@ -62,7 +62,12 @@ public class SimpleEmailListener
if (!super.equals(obj)) { if (!super.equals(obj)) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof SimpleEmailListener)) {
return false; return false;
} }
final SimpleEmailListener other = (SimpleEmailListener) obj; final SimpleEmailListener other = (SimpleEmailListener) obj;

View File

@ -62,9 +62,9 @@ public class TemplateEmailListener
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
hash = 67 * hash + Objects.hashCode(this.recipient); hash = 67 * hash + Objects.hashCode(recipient);
hash = 67 * hash + Objects.hashCode(this.subject); hash = 67 * hash + Objects.hashCode(subject);
hash = 67 * hash + Objects.hashCode(this.body); hash = 67 * hash + Objects.hashCode(body);
return hash; return hash;
} }
@ -73,7 +73,12 @@ public class TemplateEmailListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TemplateEmailListener)) {
return false; return false;
} }
final TemplateEmailListener other = (TemplateEmailListener) obj; final TemplateEmailListener other = (TemplateEmailListener) obj;
@ -81,13 +86,13 @@ public class TemplateEmailListener
return false; return false;
} }
if (!Objects.equals(this.recipient, other.recipient)) { if (!Objects.equals(recipient, other.getRecipient())) {
return false; return false;
} }
if (!Objects.equals(this.subject, other.subject)) { if (!Objects.equals(subject, other.getSubject())) {
return false; return false;
} }
return Objects.equals(this.body, other.body); return Objects.equals(body, other.getBody());
} }
@Override @Override

View File

@ -57,7 +57,12 @@ public class XmlEmailListener extends ProcessListener implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XmlEmailListener)) {
return false; return false;
} }
final XmlEmailListener other = (XmlEmailListener) obj; final XmlEmailListener other = (XmlEmailListener) obj;

View File

@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import javax.persistence.Column; import javax.persistence.Column;
@ -158,6 +159,34 @@ public class LocalizedString implements Serializable {
return values.keySet(); return values.keySet();
} }
@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + Objects.hashCode(this.values);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof LocalizedString)) {
return false;
}
final LocalizedString other = (LocalizedString) obj;
if (!other.canEqual(this)) {
return false;
}
return Objects.equals(values, other.getValues());
}
public boolean canEqual(final Object obj) {
return obj instanceof LocalizedString;
}
@Override @Override
public String toString() { public String toString() {
return String.format( return String.format(
@ -165,7 +194,7 @@ public class LocalizedString implements Serializable {
+ "%s" + "%s"
+ " }", + " }",
super.toString(), super.toString(),
values.toString()); Objects.toString(values));
} }
} }

View File

@ -110,12 +110,20 @@ public class Attachment implements Serializable {
} }
public byte[] getData() { public byte[] getData() {
if (data == null) {
return null;
} else {
return Arrays.copyOf(data, data.length); return Arrays.copyOf(data, data.length);
} }
}
public void setData(byte[] data) { public void setData(byte[] data) {
if (data == null) {
this.data = null;
} else {
this.data = Arrays.copyOf(data, data.length); this.data = Arrays.copyOf(data, data.length);
} }
}
@Override @Override
public int hashCode() { public int hashCode() {
@ -135,7 +143,7 @@ public class Attachment implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Attachment)) {
return false; return false;
} }
final Attachment other = (Attachment) obj; final Attachment other = (Attachment) obj;

View File

@ -111,12 +111,20 @@ public class Message extends CcmObject implements Serializable {
} }
public Date getSent() { public Date getSent() {
if (sent == null) {
return null;
} else {
return new Date(sent.getTime()); return new Date(sent.getTime());
} }
}
public void setSent(final Date sent) { public void setSent(final Date sent) {
if (sent == null) {
this.sent = null;
} else {
this.sent = new Date(sent.getTime()); this.sent = new Date(sent.getTime());
} }
}
public Message getInReplyTo() { public Message getInReplyTo() {
return inReplyTo; return inReplyTo;
@ -127,8 +135,12 @@ public class Message extends CcmObject implements Serializable {
} }
public List<Message> getReplies() { public List<Message> getReplies() {
if (replies == null) {
return null;
} else {
return Collections.unmodifiableList(replies); return Collections.unmodifiableList(replies);
} }
}
protected void setReplies(final List<Message> replies) { protected void setReplies(final List<Message> replies) {
this.replies = replies; this.replies = replies;
@ -143,8 +155,12 @@ public class Message extends CcmObject implements Serializable {
} }
public List<Attachment> getAttachments() { public List<Attachment> getAttachments() {
if (attachments == null) {
return null;
} else {
return Collections.unmodifiableList(attachments); return Collections.unmodifiableList(attachments);
} }
}
protected void setAttachments(final List<Attachment> attachments) { protected void setAttachments(final List<Attachment> attachments) {
this.attachments = attachments; this.attachments = attachments;
@ -177,11 +193,16 @@ public class Message extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Message)) {
return false; return false;
} }
final Message other = (Message) obj; final Message other = (Message) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -62,7 +62,12 @@ public class MessageThread extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof MessageThread)) {
return false; return false;
} }
final MessageThread other = (MessageThread) obj; final MessageThread other = (MessageThread) obj;
@ -70,7 +75,7 @@ public class MessageThread extends CcmObject implements Serializable {
return false; return false;
} }
return Objects.equals(this.root, other.getRoot()); return Objects.equals(root, other.getRoot());
} }
@Override @Override

View File

@ -28,7 +28,6 @@ import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
@ -124,12 +123,20 @@ public class Digest extends CcmObject implements Serializable {
} }
public Date getNextRun() { public Date getNextRun() {
if (nextRun == null) {
return null;
} else {
return new Date(nextRun.getTime()); return new Date(nextRun.getTime());
} }
}
public void setNextRun(final Date nextRun) { public void setNextRun(final Date nextRun) {
if (nextRun == null) {
this.nextRun = null;
} else {
this.nextRun = new Date(nextRun.getTime()); this.nextRun = new Date(nextRun.getTime());
} }
}
@Override @Override
public int hashCode() { public int hashCode() {
@ -149,11 +156,12 @@ public class Digest extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Digest)) {
return false; return false;
} }

View File

@ -36,34 +36,30 @@ import javax.persistence.TemporalType;
/** /**
* *
*The {@code Notification} class is used to create and send * The {@code Notification} class is used to create and send messages via email
* messages via email to ACS users and groups. It acts as a wrapper * to ACS users and groups. It acts as a wrapper for a {@link Message} which
* for a {@link Message} which contains the subject, sender, body and * contains the subject, sender, body and any attachments for the email. The
* any attachments for the email. The recipient can be a {@link * recipient can be a {@link
* com.arsdigita.kernel.User} or a {@link org.libreccm.core.Group}. * com.arsdigita.kernel.User} or a {@link org.libreccm.core.Group}. In the case
* In the case of Group, the message can be sent to the group's email * of Group, the message can be sent to the group's email address or expanded
* address or expanded into a separate message for each member of the * into a separate message for each member of the group.
* group.
* *
* <h4>Email Alerts</h4> * <h4>Email Alerts</h4>
* *
* When using notifications for email alerts, applications often * When using notifications for email alerts, applications often need to wrap a
* need to wrap a special header and signature around the contained * special header and signature around the contained Message object. This can be
* Message object. This can be useful for including introductory * useful for including introductory remarks and action links in the email body.
* remarks and action links in the email body. The * The {@code setHeader} and {@code setSignature} methods allow you to do this
* {@code setHeader} and {@code setSignature} methods allow * without the need to create a separate Message for the modified email.
* you to do this without the need to create a separate Message for *
* the modified email.
* *
* <h4>Digests</h4> * <h4>Digests</h4>
* *
* Finally, notifications can be sent in "instant processing mode" * Finally, notifications can be sent in "instant processing mode" or as part of
* or as part of a {@link Digest}. When sent as part of a digest all * a {@link Digest}. When sent as part of a digest all notifications to the same
* notifications to the same recipient are collected into a single * recipient are collected into a single email and sent at regular internal. For
* email and sent at regular internal. For example, an hourly digest * example, an hourly digest might send a user all of their workflow task
* might send a user all of their workflow task updates that have * updates that have changed in the past hour, rather a much larger number of
* changed in the past hour, rather a much larger number of individual * individual messages every time an tasks changed.
* messages every time an tasks changed.
* *
* (Documentation taken from the {@code com.arsdigita.notification.Notification} * (Documentation taken from the {@code com.arsdigita.notification.Notification}
* class) * class)
@ -166,20 +162,36 @@ public class Notification extends CcmObject implements Serializable {
} }
public Date getRequestDate() { public Date getRequestDate() {
if (requestDate == null) {
return null;
} else {
return new Date(requestDate.getTime()); return new Date(requestDate.getTime());
} }
}
public void setRequestDate(final Date requestDate) { public void setRequestDate(final Date requestDate) {
if (requestDate == null) {
this.requestDate = null;
} else {
this.requestDate = new Date(requestDate.getTime()); this.requestDate = new Date(requestDate.getTime());
} }
}
public Date getFulfillDate() { public Date getFulfillDate() {
if (fulfillDate == null) {
return null;
} else {
return new Date(fulfillDate.getTime()); return new Date(fulfillDate.getTime());
} }
}
public void setFulfillDate(final Date fulfillDate) { public void setFulfillDate(final Date fulfillDate) {
if (fulfillDate == null) {
this.fulfillDate = null;
} else {
this.fulfillDate = new Date(fulfillDate.getTime()); this.fulfillDate = new Date(fulfillDate.getTime());
} }
}
public String getStatus() { public String getStatus() {
return status; return status;
@ -236,7 +248,7 @@ public class Notification extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Notification)) {
return false; return false;
} }

View File

@ -160,10 +160,14 @@ public class QueueItem implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof QueueItem)) {
return false; return false;
} }
final QueueItem other = (QueueItem) obj; final QueueItem other = (QueueItem) obj;
if (!other.canEqual(this)) {
return false;
}
if (this.queueItemId != other.getQueueItemId()) { if (this.queueItemId != other.getQueueItemId()) {
return false; return false;
} }

View File

@ -62,8 +62,12 @@ public class Portal extends Resource implements Serializable {
} }
public List<Portlet> getPortlets() { public List<Portlet> getPortlets() {
if (portlets == null) {
return null;
} else {
return Collections.unmodifiableList(portlets); return Collections.unmodifiableList(portlets);
} }
}
protected void setPortlets(final List<Portlet> portlets) { protected void setPortlets(final List<Portlet> portlets) {
this.portlets = portlets; this.portlets = portlets;
@ -90,11 +94,12 @@ public class Portal extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Portal)) {
return false; return false;
} }

View File

@ -88,16 +88,17 @@ public class Portlet extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
return false;
}
if (!super.equals(obj)) { if (!super.equals(obj)) {
return false; return false;
} }
if (!(obj instanceof Portlet)) {
return false;
}
final Portlet other = (Portlet) obj; final Portlet other = (Portlet) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -90,8 +90,12 @@ public class Initalizer implements Serializable {
} }
public List<Initalizer> getRequiredInitializers() { public List<Initalizer> getRequiredInitializers() {
if (requiredInitializers == null) {
return null;
} else {
return Collections.unmodifiableList(requiredInitializers); return Collections.unmodifiableList(requiredInitializers);
} }
}
protected void setRequiredInitializers( protected void setRequiredInitializers(
final List<Initalizer> requiredInitializers) { final List<Initalizer> requiredInitializers) {
@ -122,7 +126,7 @@ public class Initalizer implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Initalizer)) {
return false; return false;
} }
final Initalizer other = (Initalizer) obj; final Initalizer other = (Initalizer) obj;

View File

@ -59,13 +59,13 @@ public class Document implements Serializable {
@Column(name = "document_timestamp") @Column(name = "document_timestamp")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date documentTimeStamp; private Date timeStamp;
@Column(name = "dirty") @Column(name = "dirty")
private long dirty; private long dirty;
@Column(name = "document_language", length = 8) @Column(name = "document_language", length = 8)
private String documentLanguage; private String language;
@Column(name = "country", length = 8) @Column(name = "country", length = 8)
private String country; private String country;
@ -127,12 +127,20 @@ public class Document implements Serializable {
this.typeSpecificInfo = typeSpecificInfo; this.typeSpecificInfo = typeSpecificInfo;
} }
public Date getDocumentTimeStamp() { public Date getTimeStamp() {
return new Date(documentTimeStamp.getTime()); if (timeStamp == null) {
return null;
} else {
return new Date(timeStamp.getTime());
}
} }
public void setDocumentTimeStamp(final Date documentTimeStamp) { public void setTimeStamp(final Date timeStamp) {
this.documentTimeStamp = new Date(documentTimeStamp.getTime()); if (timeStamp == null) {
this.timeStamp = null;
} else {
this.timeStamp = new Date(timeStamp.getTime());
}
} }
public long getDirty() { public long getDirty() {
@ -143,12 +151,12 @@ public class Document implements Serializable {
this.dirty = dirty; this.dirty = dirty;
} }
public String getDocumentLanguage() { public String getLanguage() {
return documentLanguage; return language;
} }
public void setDocumentLanguage(final String documentLanguage) { public void setLanguage(final String language) {
this.documentLanguage = documentLanguage; this.language = language;
} }
public String getCountry() { public String getCountry() {
@ -184,12 +192,20 @@ public class Document implements Serializable {
} }
public Date getCreated() { public Date getCreated() {
if (created == null) {
return null;
} else {
return new Date(created.getTime()); return new Date(created.getTime());
} }
}
public void setCreated(final Date created) { public void setCreated(final Date created) {
if (created == null) {
this.created = null;
} else {
this.created = new Date(created.getTime()); this.created = new Date(created.getTime());
} }
}
public Party getCreatedBy() { public Party getCreatedBy() {
return createdBy; return createdBy;
@ -200,12 +216,20 @@ public class Document implements Serializable {
} }
public Date getLastModified() { public Date getLastModified() {
if (lastModified == null) {
return null;
} else {
return new Date(lastModified.getTime()); return new Date(lastModified.getTime());
} }
}
public void setLastModified(final Date lastModified) { public void setLastModified(final Date lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new Date(lastModified.getTime()); this.lastModified = new Date(lastModified.getTime());
} }
}
public Party getLastModifiedBy() { public Party getLastModifiedBy() {
return lastModifiedBy; return lastModifiedBy;
@ -229,9 +253,9 @@ public class Document implements Serializable {
hash = 53 * hash + (int) (documentId ^ (documentId >>> 32)); hash = 53 * hash + (int) (documentId ^ (documentId >>> 32));
hash = 53 * hash + Objects.hashCode(type); hash = 53 * hash + Objects.hashCode(type);
hash = 53 * hash + Objects.hashCode(typeSpecificInfo); hash = 53 * hash + Objects.hashCode(typeSpecificInfo);
hash = 53 * hash + Objects.hashCode(documentTimeStamp); hash = 53 * hash + Objects.hashCode(timeStamp);
hash = 53 * hash + (int) (dirty ^ (dirty >>> 32)); hash = 53 * hash + (int) (dirty ^ (dirty >>> 32));
hash = 53 * hash + Objects.hashCode(documentLanguage); hash = 53 * hash + Objects.hashCode(language);
hash = 53 * hash + Objects.hashCode(country); hash = 53 * hash + Objects.hashCode(country);
hash = 53 * hash + Objects.hashCode(title); hash = 53 * hash + Objects.hashCode(title);
hash = 53 * hash + Objects.hashCode(summary); hash = 53 * hash + Objects.hashCode(summary);
@ -249,10 +273,14 @@ public class Document implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Document)) {
return false; return false;
} }
final Document other = (Document) obj; final Document other = (Document) obj;
if (!other.canEqual(this)) {
return false;
}
if (documentId != other.getDocumentId()) { if (documentId != other.getDocumentId()) {
return false; return false;
} }
@ -262,13 +290,13 @@ public class Document implements Serializable {
if (!Objects.equals(typeSpecificInfo, other.getTypeSpecificInfo())) { if (!Objects.equals(typeSpecificInfo, other.getTypeSpecificInfo())) {
return false; return false;
} }
if (!Objects.equals(documentTimeStamp, other.getDocumentTimeStamp())) { if (!Objects.equals(timeStamp, other.getTimeStamp())) {
return false; return false;
} }
if (dirty != other.getDirty()) { if (dirty != other.getDirty()) {
return false; return false;
} }
if (!Objects.equals(documentLanguage, other.getDocumentLanguage())) { if (!Objects.equals(language, other.getLanguage())) {
return false; return false;
} }
if (!Objects.equals(country, other.getCountry())) { if (!Objects.equals(country, other.getCountry())) {
@ -298,6 +326,10 @@ public class Document implements Serializable {
return Objects.equals(contentSection, other.getContentSection()); return Objects.equals(contentSection, other.getContentSection());
} }
public boolean canEqual(final Object obj) {
return obj instanceof Document;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "
@ -317,9 +349,9 @@ public class Document implements Serializable {
super.toString(), super.toString(),
documentId, documentId,
type, type,
documentTimeStamp, timeStamp,
dirty, dirty,
documentLanguage, language,
country, country,
title, title,
created, created,

View File

@ -97,10 +97,14 @@ public class Index implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Index)) {
return false; return false;
} }
final Index other = (Index) obj; final Index other = (Index) obj;
if (!other.canEqual(this)) {
return false;
}
if (indexId != other.getIndexId()) { if (indexId != other.getIndexId()) {
return false; return false;
} }
@ -110,6 +114,10 @@ public class Index implements Serializable {
return luceneIndexId == other.getLuceneIndexId(); return luceneIndexId == other.getLuceneIndexId();
} }
public boolean canEqual(final Object obj) {
return obj instanceof Index;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "

View File

@ -80,11 +80,12 @@ public class Application extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Application)) {
return false; return false;
} }
@ -99,6 +100,11 @@ public class Application extends Resource implements Serializable {
return Objects.equals(containerGroup, other.getContainerGroup()); return Objects.equals(containerGroup, other.getContainerGroup());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof Application;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", primaryUrl = \"%s\", " return super.toString(String.format(", primaryUrl = \"%s\", "

View File

@ -90,10 +90,13 @@ public class Host implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Host)) {
return false; return false;
} }
final Host other = (Host) obj; final Host other = (Host) obj;
if (!other.canEqual(this)) {
return false;
}
if (this.hostId != other.getHostId()) { if (this.hostId != other.getHostId()) {
return false; return false;
} }
@ -103,6 +106,10 @@ public class Host implements Serializable {
return this.serverPort == other.getServerPort(); return this.serverPort == other.getServerPort();
} }
public boolean canEqual(final Object obj) {
return obj instanceof Host;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "

View File

@ -163,8 +163,12 @@ public class Task implements Serializable {
} }
public List<Task> getDependentTasks() { public List<Task> getDependentTasks() {
if (dependentTasks == null) {
return null;
} else {
return Collections.unmodifiableList(dependentTasks); return Collections.unmodifiableList(dependentTasks);
} }
}
protected void setDependentTasks(final List<Task> dependentTasks) { protected void setDependentTasks(final List<Task> dependentTasks) {
this.dependentTasks = dependentTasks; this.dependentTasks = dependentTasks;
@ -179,8 +183,12 @@ public class Task implements Serializable {
} }
public List<Task> getDependsOn() { public List<Task> getDependsOn() {
if (dependsOn == null) {
return null;
} else {
return Collections.unmodifiableList(dependsOn); return Collections.unmodifiableList(dependsOn);
} }
}
protected void setDependsOn(final List<Task> dependsOn) { protected void setDependsOn(final List<Task> dependsOn) {
this.dependsOn = dependsOn; this.dependsOn = dependsOn;
@ -195,8 +203,12 @@ public class Task implements Serializable {
} }
public List<String> getComments() { public List<String> getComments() {
if (comments == null) {
return null;
} else {
return Collections.unmodifiableList(comments); return Collections.unmodifiableList(comments);
} }
}
protected void setComments(final List<String> comments) { protected void setComments(final List<String> comments) {
this.comments = comments; this.comments = comments;
@ -230,11 +242,11 @@ public class Task implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Task)) {
return false; return false;
} }
final Task other = (Task) obj; final Task other = (Task) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }
@ -294,4 +306,5 @@ public class Task implements Serializable {
Objects.toString(dependsOn), Objects.toString(dependsOn),
data); data);
} }
} }

View File

@ -109,20 +109,36 @@ public class UserTask extends Task implements Serializable {
} }
public Date getStartDate() { public Date getStartDate() {
if (startDate == null) {
return null;
} else {
return new Date(startDate.getTime()); return new Date(startDate.getTime());
} }
}
public void setStartDate(final Date startDate) { public void setStartDate(final Date startDate) {
if (startDate == null) {
this.startDate = null;
} else {
this.startDate = new Date(startDate.getTime()); this.startDate = new Date(startDate.getTime());
} }
}
public Date getDueDate() { public Date getDueDate() {
if (dueDate == null) {
return null;
} else {
return new Date(dueDate.getTime()); return new Date(dueDate.getTime());
} }
}
public void setDueDate(final Date dueDate) { public void setDueDate(final Date dueDate) {
if (dueDate == null) {
this.dueDate = null;
} else {
this.dueDate = new Date(dueDate.getTime()); this.dueDate = new Date(dueDate.getTime());
} }
}
public long getDurationMinutes() { public long getDurationMinutes() {
return durationMinutes; return durationMinutes;
@ -141,8 +157,12 @@ public class UserTask extends Task implements Serializable {
} }
public List<User> getAssignedUsers() { public List<User> getAssignedUsers() {
if (assignedUsers == null) {
return null;
} else {
return Collections.unmodifiableList(assignedUsers); return Collections.unmodifiableList(assignedUsers);
} }
}
protected void setAssignedUsers(final List<User> assignedUsers) { protected void setAssignedUsers(final List<User> assignedUsers) {
this.assignedUsers = assignedUsers; this.assignedUsers = assignedUsers;
@ -157,8 +177,12 @@ public class UserTask extends Task implements Serializable {
} }
public List<UserGroup> getAssignedGroups() { public List<UserGroup> getAssignedGroups() {
if (assignedGroups == null) {
return null;
} else {
return Collections.unmodifiableList(assignedGroups); return Collections.unmodifiableList(assignedGroups);
} }
}
protected void setAssignedGroups(final List<UserGroup> assignedGroups) { protected void setAssignedGroups(final List<UserGroup> assignedGroups) {
this.assignedGroups = assignedGroups; this.assignedGroups = assignedGroups;
@ -192,11 +216,16 @@ public class UserTask extends Task implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof UserTask)) {
return false; return false;
} }
final UserTask other = (UserTask) obj; final UserTask other = (UserTask) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }
@ -224,6 +253,11 @@ public class UserTask extends Task implements Serializable {
return Objects.equals(assignedGroups, other.getAssignedGroups()); return Objects.equals(assignedGroups, other.getAssignedGroups());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof UserTask;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", locked = %b, " return super.toString(String.format(", locked = %b, "

View File

@ -106,8 +106,12 @@ public class Workflow implements Serializable {
} }
public List<Task> getTasks() { public List<Task> getTasks() {
if (tasks == null) {
return null;
} else {
return Collections.unmodifiableList(tasks); return Collections.unmodifiableList(tasks);
} }
}
protected void setTasks(final List<Task> tasks) { protected void setTasks(final List<Task> tasks) {
this.tasks = tasks; this.tasks = tasks;
@ -135,11 +139,11 @@ public class Workflow implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Workflow)) {
return false; return false;
} }
final Workflow other = (Workflow) obj; final Workflow other = (Workflow) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -18,9 +18,11 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
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;
@ -32,7 +34,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@org.junit.experimental.categories.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() {
@ -43,8 +47,32 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
DomainOwnership.class}); DomainOwnership.class});
} }
public EqualsAndHashCodeTest(final Class<?> entitiesClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entitiesClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Category category1 = new Category();
category1.setName("Category One");
final Category category2 = new Category();
category2.setName("Category Two");
final Domain domain1 = new Domain();
domain1.setDomainKey("Domain-One");
final Domain domain2 = new Domain();
domain2.setDomainKey("Domain Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Category.class, category1, category2)
.withPrefabValues(Domain.class, domain1, domain2)
.verify();
} }
} }

View File

@ -18,10 +18,12 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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;
@ -33,7 +35,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -53,6 +57,45 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
} }
@Test
public void verifyEqualsAndHashCode() {
final Component component1 = new Component();
component1.setAdminName("Component One");
final Component component2 = new Component();
component2.setAdminName("Component Two");
final WidgetLabel widgetLabel1 = new WidgetLabel();
widgetLabel1.setAdminName("WidgetLabel One");
final WidgetLabel widgetLabel2 = new WidgetLabel();
widgetLabel2.setAdminName("WidgetLabel Two");
final Widget widget1 = new Widget();
widget1.setAdminName("Widget 1");
final Widget widget2 = new Widget();
widget2.setAdminName("Widget 2");
final FormSection formSection1 = new FormSection();
formSection1.setAdminName("FormSection One");
final FormSection formSection2 = new FormSection();
formSection2.setAdminName("FormSection Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Component.class, component1, component2)
.withPrefabValues(WidgetLabel.class, widgetLabel1, widgetLabel2)
.withPrefabValues(Widget.class, widget1, widget2)
.withPrefabValues(FormSection.class, formSection1, formSection2)
.verify();
}
} }

View File

@ -18,10 +18,14 @@
*/ */
package org.libreccm.formbuilder.actions; package org.libreccm.formbuilder.actions;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.formbuilder.Component;
import org.libreccm.formbuilder.FormSection;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import java.util.Arrays; import java.util.Arrays;
@ -33,7 +37,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -48,7 +54,31 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Component component1 = new Component();
component1.setAdminName("Component One");
final Component component2 = new Component();
component2.setAdminName("Component Two");
final FormSection formSection1 = new FormSection();
formSection1.setAdminName("FormSection One");
final FormSection formSection2 = new FormSection();
formSection2.setAdminName("FormSection Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Component.class, component1, component2)
.withPrefabValues(FormSection.class, formSection1, formSection2)
.verify();
} }
} }

View File

@ -18,9 +18,12 @@
*/ */
package org.libreccm.l10n; package org.libreccm.l10n;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.messaging.Message;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier; import org.libreccm.testutils.EqualsVerifier;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -43,7 +48,26 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
} }
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
nl.jqno.equalsverifier.EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
}
} }

View File

@ -18,11 +18,12 @@
*/ */
package org.libreccm.messaging; package org.libreccm.messaging;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +34,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -45,7 +48,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
nl.jqno.equalsverifier.EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
} }
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.notification; package org.libreccm.notification;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.messaging.Message;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -45,7 +50,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
} }
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.portal; package org.libreccm.portal;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.core.Resource;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -44,6 +49,31 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityTest) { public EqualsAndHashCodeTest(final Class<?> entityTest) {
super(entityTest); this.entityClass = entityTest;
} }
@Test
public void verifyEqualsAndHashCode() {
final Portal portal1 = new Portal();
portal1.setDisplayName("Portal One");
final Portal portal2 = new Portal();
portal2.setDisplayName("Portal Two");
final Resource resource1 = new Resource();
resource1.setDisplayName("Resource One");
final Resource resource2 = new Resource();
resource2.setDisplayName("Resource Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Portal.class, portal1, portal2)
.withPrefabValues(Resource.class, resource1, resource2)
.verify();
}
} }

View File

@ -18,11 +18,13 @@
*/ */
package org.libreccm.runtime; package org.libreccm.runtime;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +35,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -43,8 +47,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
} }
@Test
public void verifyEqualsAndHashCode() {
final Initalizer initalizer1 = new Initalizer();
initalizer1.setClassName("org.example.foo.Initalizer");
final Initalizer initalizer2 = new Initalizer();
initalizer2.setClassName("org.example.bar.Initalizer");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Initalizer.class, initalizer1, initalizer2)
.verify();
}
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.web; package org.libreccm.web;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; 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.core.Resource;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @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() {
@ -44,7 +49,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Resource resource1 = new Resource();
resource1.setDisplayName("Resource One");
final Resource resource2 = new Resource();
resource2.setDisplayName("Resource Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Resource.class, resource1, resource2)
.verify();
} }
} }