Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wojciechzankowski/tostringverifier
Why would you like to test toString method
https://github.com/wojciechzankowski/tostringverifier
junit stringverifier test test-framework testing testing-framework tostringverifier
Last synced: about 2 months ago
JSON representation
Why would you like to test toString method
- Host: GitHub
- URL: https://github.com/wojciechzankowski/tostringverifier
- Owner: WojciechZankowski
- License: apache-2.0
- Created: 2019-06-02T22:21:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T21:07:46.000Z (almost 4 years ago)
- Last Synced: 2024-05-10T22:07:43.218Z (9 months ago)
- Topics: junit, stringverifier, test, test-framework, testing, testing-framework, tostringverifier
- Language: Java
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ToStringVerifier: Useless library to verify toString method
[![Build Status](https://travis-ci.org/WojciechZankowski/ToStringVerifier.svg?branch=master)](https://travis-ci.org/WojciechZankowski/ToStringVerifier)
[![codecov](https://codecov.io/gh/WojciechZankowski/ToStringVerifier/branch/master/graph/badge.svg)](https://codecov.io/gh/WojciechZankowski/ToStringVerifier)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=pl.zankowski%3Atostringverifier&metric=alert_status)](https://sonarcloud.io/dashboard/index/pl.zankowski:tostringverifier)
[![Maven Central](https://img.shields.io/maven-central/v/pl.zankowski/tostringverifier.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22pl.zankowski%22%20AND%20a:%22tostringverifier%22)## Table of Contents
* [Quick Start](#quick-start)
* [Description](#description)
* [How to](#how-to)
* [License](#license)## Quick Start
Maven:
```
pl.zankowski
tostringverifier
0.9.1```
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 Lang3Generally 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