Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Additional assertions for the fest-assert lib

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.org
Octocat-spinner-32 pom.xml
README.org

fest-assert-goodies

What’s this ?

fest-assert is a great Java testing library.

fest-assert-goodies adds extra assertions to it.

Right now there’s:

  • DeepEqual: Deep compare two objects, compared classes don’t need to override equals.
  • XmlEqual: Compare two XML strings, formatting is ignored.

Two minutes tutorial

Maven setup

Add Maven repository to your pom.xml
<repositories>
  <repository>
    <id>fest-assert-goodies-repo</id>
    <url>https://denlab-maven-repository.googlecode.com/svn/repository</url>
  </repository>
</repositories>
Add dependency to your pom.xml
<dependencies>
  <dependency>
    <groupId>org</groupId>
    <artifactId>fest-assert-goodies</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
  </dependency>
</dependencies>

Using

DeepEqual
@Test
public void testIsDeepEqual() throws Exception {
	OuterClass actual = new OuterClass(new InnerClass("inner_"), "outer");
	OuterClass expected = new OuterClass(new InnerClass("inner"), "outer");

	assertThat(new DeepEqual(actual)).isDeepEqual(expected);
}
  • Compared classes don’t need to override equals.
  • Diff view in Eclipse:

http://img52.imageshack.us/img52/7918/comparisondeep.png

XmlEqual
@Test
public void testXmlEqual() {
	assertThat(new XmlEqual("<a><b x='1'></b></a>")).isXmlEqual(
			"    <a><b x='2'></b></a>");
}
  • XML formating is ignored.
  • Diff view in Eclipse:

http://img811.imageshack.us/img811/2521/comparisonxml.png

Additional infos

License

Copyright 2011 fest-assert-goodies Committers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License.
Something went wrong with that request. Please try again.