|
EasyMock example source code file (ConstraintsToStringTest.java)
The EasyMock ConstraintsToStringTest.java source code/* * Copyright (c) 2001-2007 OFFIS, Tammo Freese. * This program is made available under the terms of the MIT License. */ package org.easymock.tests2; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; import org.easymock.IArgumentMatcher; import org.easymock.internal.matchers.*; import org.junit.Before; import org.junit.Test; public class ConstraintsToStringTest { private StringBuffer buffer; @Before public void setup() { buffer = new StringBuffer(); } @Test public void sameToStringWithString() { new Same("X").appendTo(buffer); assertEquals("same(\"X\")", buffer.toString()); } @Test public void nullToString() { Null.NULL.appendTo(buffer); assertEquals("isNull()", buffer.toString()); } @Test public void notNullToString() { NotNull.NOT_NULL.appendTo(buffer); assertEquals("notNull()", buffer.toString()); } @Test public void anyToString() { Any.ANY.appendTo(buffer); assertEquals("<any>", buffer.toString()); } @Test public void sameToStringWithChar() { new Same('x').appendTo(buffer); assertEquals("same('x')", buffer.toString()); } @Test public void sameToStringWithObject() { Object o = new Object() { @Override public String toString() { return "X"; } }; new Same(o).appendTo(buffer); assertEquals("same(X)", buffer.toString()); } @Test public void equalsToStringWithString() { new Equals("X").appendTo(buffer); assertEquals("\"X\"", buffer.toString()); } @Test public void equalsToStringWithChar() { new Equals('x').appendTo(buffer); assertEquals("'x'", buffer.toString()); } @Test public void equalsToStringWithObject() { Object o = new Object() { @Override public String toString() { return "X"; } }; new Equals(o).appendTo(buffer); assertEquals("X", buffer.toString()); } @Test public void orToString() { List<IArgumentMatcher> matchers = new ArrayList Other EasyMock examples (source code examples)Here is a short list of links related to this EasyMock ConstraintsToStringTest.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.