Hamcrest multi-line text matcher

This project provides a Hamcrest matcher that gives you better diagnostics for multi-line text in case of mismatches.

License

License

GroupId

GroupId

org.itsallcode
ArtifactId

ArtifactId

hamcrest-mutliline-text-matcher
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Hamcrest multi-line text matcher
This project provides a Hamcrest matcher that gives you better diagnostics for multi-line text in case of mismatches.
Project URL

Project URL

https://github.com/itsallcode/hamcrest-mutliline-text-matcher
Project Organization

Project Organization

itsallcode.org
Source Code Management

Source Code Management

https://github.com/itsallcode/hamcrest-mutliline-text-matcher

Download hamcrest-mutliline-text-matcher

How to add to project

<!-- https://jarcasting.com/artifacts/org.itsallcode/hamcrest-mutliline-text-matcher/ -->
<dependency>
    <groupId>org.itsallcode</groupId>
    <artifactId>hamcrest-mutliline-text-matcher</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.itsallcode/hamcrest-mutliline-text-matcher/
implementation 'org.itsallcode:hamcrest-mutliline-text-matcher:2.0.1'
// https://jarcasting.com/artifacts/org.itsallcode/hamcrest-mutliline-text-matcher/
implementation ("org.itsallcode:hamcrest-mutliline-text-matcher:2.0.1")
'org.itsallcode:hamcrest-mutliline-text-matcher:jar:2.0.1'
<dependency org="org.itsallcode" name="hamcrest-mutliline-text-matcher" rev="2.0.1">
  <artifact name="hamcrest-mutliline-text-matcher" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.itsallcode', module='hamcrest-mutliline-text-matcher', version='2.0.1')
)
libraryDependencies += "org.itsallcode" % "hamcrest-mutliline-text-matcher" % "2.0.1"
[org.itsallcode/hamcrest-mutliline-text-matcher "2.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.7.0

Project Modules

There are no modules declared in this project.

hamcrest-mutliline-text-matcher

This project provides a Hamcrest matcher that gives you better diagnostics for multi-line text in case of mismatches.

Build Maven Central Quality Gate Status Coverage

In a Nutshell

import static org.itsallcode.matcher.MultilineTextMatcher.matchesAllLines;

public class TestSomeText {
	@Test
	public void testMatchesAllLines() {
		assertThat("foo\nbar", MultilineTextMatcher.matchesAllLines("foo", "bar"));
	}
}

Features

This matcher provides the following features:

  • Reports mismatches in the number of lines
  • Marks where in the text a mismatch is found
  • Makes invisible characters visible (CR, LF, TAB)

Information for Developers

Dependencies

Runtime Dependencies

The Hamcrest Multiline Text Matcher requires Java 11 to run.

Test Dependencies

Test Dependencies

Dependency Purpose License
Apache Maven Build tool Apache License 2.0
Java Hamcrest Checking for conditions in code via matchers BSD License
JUnit Unit testing framework Eclipse Public License 1.0

Maven Plug-ins

Plug-in Purpose License
License Maven Plugin Adding license information to source files LGPL3
Maven Compiler Plugin Setting required Java version Apache License 2.0
Maven Enforcer Plugin Controlling environment constants Apache License 2.0
Maven Failsafe Plugin Integration testing Apache License 2.0
Maven Jacoco Plugin Code coverage metering Eclipse Public License 2.0
Maven Javadoc Plugin Create JAR archive with Javadoc Apache License 2.0
Maven Source Plugin Create JAR archive with source code Apache License 2.0
Maven Surefire Plugin Unit testing Apache License 2.0
OSS Index Maven Plugin Checking Dependencies Vulnerability ASL2
Versions Maven Plugin Checking if dependencies updates are available Apache License 2.0

Development

Generate / update license file header

mvn license:update-file-header

Run local sonar analysis

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
    -Dsonar.host.url=https://sonarcloud.io \
    -Dsonar.organization=itsallcode \
    -Dsonar.login=[token]

See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ahamcrest-mutliline-text-matcher

Check for updated dependencies / plugins

mvn versions:display-dependency-updates
mvn versions:display-plugin-updates

Publishing to JCenter

  1. Add the following to your ~/.m2/settings.xml:

    <settings>
        <servers>
            <server>
                <id>ossrh</id>
                <username>your-jira-id</username>
                <password>your-jira-pwd</password>
            </server>
        </servers>
        <profiles>
            <profile>
                <id>ossrh</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <gpg.executable>gpg</gpg.executable>
                    <gpg.passphrase>the_pass_phrase</gpg.passphrase>
                </properties>
            </profile>
        </profiles>
    </settings>
  2. Checkout the master branch.

  3. Update version in pom.xml, commit and push.

  4. Run command

    mvn -DskipSigningArtifacts=false clean deploy
  5. Create a release of the master branch on GitHub.

  6. After some time the release will be available at Maven Central.

org.itsallcode

It's all code

Community of everything-as-code enthusiasts

Versions

Version
2.0.1
2.0.0
1.0.0