Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JUnit 3.8.1 Example Program for Hamcrest 1.3
Where can I find an example program to use JUnit 3.8.1 with Hamcrest 1.3?
✍: FYIcenter.com
Hamcrest is a framework for writing matcher objects allowing 'match' rules to be defined declaratively.
The hamcrest-generator-1.3.zip contains a some examples on how to use Hamcrest
with JUnit 3.x and JUnit 4.x in the "hamcrest-examples" folder.
Here is the source of ExampleWithAssertThat.java:
package org.hamcrest.examples.junit3; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import junit.framework.TestCase; /** * Demonstrates how Hamcrest matchers can be used with assertThat() * using JUnit 3.8.x. * * @author Joe Walnes */ public class ExampleWithAssertThat extends TestCase { public void testUsingAssertThat() { assertThat("xx", is("xx")); assertThat("yy", is(not("xx"))); assertThat("i like cheese", containsString("cheese")); } }
This example shows that:
2016-03-25, 2572🔥, 0💬
Popular Posts:
JDK 11 jdk.localedata.jmod is the JMOD file for JDK 11 Localedata module. JDK 11 Locale Data module ...
layout.jar is a component in iText Java library to provide layout functionalities. iText Java librar...
What Is javamail-1_2.zip? javamail-1_2.zip is the binary package of JavaMail API 1.2 in ZIP format. ...
What Is javamail-1_2.zip? javamail-1_2.zip is the binary package of JavaMail API 1.2 in ZIP format. ...
JDK 11 jdk.crypto.mscapi.jmod is the JMOD file for JDK 11 Crypto MSCAPI module. JDK 11 Crypto MSCAPI...