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 overrideequals
.XmlEqual
: Compare two XML strings, formatting is ignored.
<repositories>
<repository>
<id>fest-assert-goodies-repo</id>
<url>https://denlab-maven-repository.googlecode.com/svn/repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org</groupId>
<artifactId>fest-assert-goodies</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
@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:
@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:
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.