Skip to content

Instantly share code, notes, and snippets.

@michaelajr
Created May 26, 2018 17:18
Show Gist options
  • Save michaelajr/9138ee9143df8fb5ef73018f44356ac2 to your computer and use it in GitHub Desktop.
Save michaelajr/9138ee9143df8fb5ef73018f44356ac2 to your computer and use it in GitHub Desktop.
Maven For Pipelining, Part 3
package com.eoniantech.echoapi.domain.model;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
/**
* Test class for the {@link Message} model's equals method.
*
* @author Michael Andrews <Michael.Andrews@eoniantech.com>
* @since 1.0
*/
public class MessageTest_equals {
private Message message;
@Before
public void before() {
message = new Message("This is a message");
}
@Test
public void testEquals_same_message() {
assertTrue(
message.equals(
new Message(
"This is a message")));
}
@Test
public void testEquals_same_object() {
assertTrue(
message.equals(
message));
}
@Test
@SuppressWarnings("ObjectEqualsNull")
public void testEquals_null_object() {
assertFalse(
message.equals(
null));
}
@Test
public void testEquals_different_message() {
assertFalse(
message.equals(
new Message(
"This is a different message")));
}
@Test
@SuppressWarnings("RedundantStringConstructorCall")
public void testEquals_different_object() {
assertFalse(
message.equals(
(Object) new String(
"This is a String")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment