ToStringVerifier: Useless library to verify toString method
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