ToStringVerifier

Why would like to test toString method

License

License

GroupId

GroupId

pl.zankowski
ArtifactId

ArtifactId

tostringverifier
Last Version

Last Version

0.9.1
Release Date

Release Date

Type

Type

jar
Description

Description

ToStringVerifier
Why would like to test toString method
Project URL

Project URL

https://github.com/WojciechZankowski/ToStringVerifier
Source Code Management

Source Code Management

https://github.com/WojciechZankowski/ToStringVerifier

Download tostringverifier

How to add to project

<!-- https://jarcasting.com/artifacts/pl.zankowski/tostringverifier/ -->
<dependency>
    <groupId>pl.zankowski</groupId>
    <artifactId>tostringverifier</artifactId>
    <version>0.9.1</version>
</dependency>
// https://jarcasting.com/artifacts/pl.zankowski/tostringverifier/
implementation 'pl.zankowski:tostringverifier:0.9.1'
// https://jarcasting.com/artifacts/pl.zankowski/tostringverifier/
implementation ("pl.zankowski:tostringverifier:0.9.1")
'pl.zankowski:tostringverifier:jar:0.9.1'
<dependency org="pl.zankowski" name="tostringverifier" rev="0.9.1">
  <artifact name="tostringverifier" type="jar" />
</dependency>
@Grapes(
@Grab(group='pl.zankowski', module='tostringverifier', version='0.9.1')
)
libraryDependencies += "pl.zankowski" % "tostringverifier" % "0.9.1"
[pl.zankowski/tostringverifier "0.9.1"]

Dependencies

compile (5)

Group / Artifact Type Version
com.google.guava : guava jar 27.1-jre
org.apache.commons : commons-lang3 jar 3.9
com.flextrade.jfixture : jfixture jar 2.7.2
pl.zankowski : iextrading4j-api jar 3.1.0
org.assertj : assertj-core jar 3.12.2

provided (1)

Group / Artifact Type Version
org.immutables : value jar 2.7.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.27.0

Project Modules

There are no modules declared in this project.

ToStringVerifier: Useless library to verify toString method

Build Status codecov Quality Gate Maven Central

Table of Contents

Quick Start

Maven:

<dependency>
	<groupId>pl.zankowski</groupId>
	<artifactId>tostringverifier</artifactId>
	<version>0.9.1</version>
</dependency>

Gradle:

dependencies {
	compile 'pl.zankowski:tostringverifier:0.9.1'
}

Description

This is simple library to test if your generated toString method is correctly built. It means it contains all fields in the class and has the right formatting according to the selected generation type. Currently supported generation methods:

  • Guava
  • String Joiner
  • String Concat
  • String Builder
  • String Buffer
  • Apache Lang3

Generally this library is useless.

How to

Strict verification - verifies if whole string, so it also takes order of fields into the consideration

ToStringVerifier.forClass(YourObject.class)
        .withGeneratorType(GeneratorType.GUAVA_18_PLUS)
        .withStrictVerification()
        .verify();

Not strict verification - just checks if all fields are in the toString output and it prefix and suffix of the string is correct.

ToStringVerifier.forClass(YourObject.class)
        .withGeneratorType(GeneratorType.GUAVA_18_PLUS)
        .verify();

License

Code and documentation released under the Apache License, Version 2.0

Versions

Version
0.9.1
0.9.0