assertj-diff

AssertJ assertions for diffing strings and files.

License

License

GroupId

GroupId

io.github.robwin
ArtifactId

ArtifactId

assertj-diff
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

assertj-diff
AssertJ assertions for diffing strings and files.
Project URL

Project URL

https://github.com/RobWin/assertj-diff
Source Code Management

Source Code Management

https://github.com/RobWin/assertj-diff.git

Download assertj-diff

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.robwin/assertj-diff/ -->
<dependency>
    <groupId>io.github.robwin</groupId>
    <artifactId>assertj-diff</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.robwin/assertj-diff/
implementation 'io.github.robwin:assertj-diff:0.1.1'
// https://jarcasting.com/artifacts/io.github.robwin/assertj-diff/
implementation ("io.github.robwin:assertj-diff:0.1.1")
'io.github.robwin:assertj-diff:jar:0.1.1'
<dependency org="io.github.robwin" name="assertj-diff" rev="0.1.1">
  <artifact name="assertj-diff" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.robwin', module='assertj-diff', version='0.1.1')
)
libraryDependencies += "io.github.robwin" % "assertj-diff" % "0.1.1"
[io.github.robwin/assertj-diff "0.1.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.18
org.assertj : assertj-core jar 2.2.0
com.sksamuel.diff : diff jar 1.1.11
commons-io : commons-io jar 2.4

Project Modules

There are no modules declared in this project.

assertj-diff

Build Status download Apache License 2 Twitter

Overview

This library provides AssertJ assertions for diffing files. If a test fails, it generates an HTML report.
It uses google-diff-match-patch to do the hard stuff.

The project requires at least JDK 7.

Usage

Adding assertj-diff to your project

The project is published in JCenter and Maven Central.

Maven

<repositories>
    <repository>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray</name>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>

<dependency>
    <groupId>io.github.robwin</groupId>
    <artifactId>assertj-diff</artifactId>
    <version>0.1.1</version>
</dependency>

Gradle

repositories {
    jcenter()
}

compile "io.github.robwin:assertj-diff:0.1.1"

Using assertj-diff

You can compare two files by providing the path to the actual file and to the expected file.

Path actualFile = Paths.get(DiffAssertTest.class.getResource("/actualFile.txt").toURI());
Path expectedFile = Paths.get(DiffAssertTest.class.getResource("/expectedFile.txt").toURI());
Path reportPath = Paths.get("build/diff-result.txt");

DiffAssertions.assertThat(actualFilePath).isEqualTo(expectedFilePath, reportPath)

If the test fails, assertj-diff generates a HTML into the given reportPath.

Report Example

diff result

License

Copyright 2016 Robert Winkler

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.

Versions

Version
0.1.1
0.1.0