|
Java example source code file (MessageTest.java)
The MessageTest.java Java example source codepackage com.google.inject.spi; import com.google.common.collect.Lists; import junit.framework.TestCase; import java.util.List; /** * Tests for {@link Message}. */ public class MessageTest extends TestCase { public void testMessageHashCodeVariesWithSource() { String innerMessage = "This is the message."; Message firstMessage = new Message(1, innerMessage); Message secondMessage = new Message(2, innerMessage); assertFalse(firstMessage.hashCode() == secondMessage.hashCode()); } public void testMessageHashCodeVariesWithCause() { String innerMessage = "This is the message."; List<Object> sourceList = Lists.newArrayList(new Object()); // the throwable argument of each Message below do not have value equality Message firstMessage = new Message(sourceList, innerMessage, new Exception(innerMessage)); Message secondMessage = new Message(sourceList, innerMessage, new Exception(innerMessage)); assertFalse(firstMessage.hashCode() == secondMessage.hashCode()); } } Other Java examples (source code examples)Here is a short list of links related to this Java MessageTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.