cowtowncoder / java-uuid-generator

Java Uuid Generator (JUG) is a Java library for generating all standard UUID versions (v1 - v7)
Apache License 2.0
699 stars 103 forks source link

feat(test): cowtowncoder#87 Add tests to jug #113

Closed SquireOfSoftware closed 3 weeks ago

SquireOfSoftware commented 3 weeks ago

What did I do?

As per this comment: https://github.com/cowtowncoder/java-uuid-generator/issues/87#issuecomment-2155763312, I wrote some tests for Jug.

I took the liberty to "destaticise" the main static methods so that it was easier to target inside of the tests. Take note that some of the styling changes were automatically applied by Intellij so I apologise in advance for that, if it needs to be rolled back let me know.

The general gist of the work is, run through the run method, swap out the System.out and System.err outputStreams using: https://stackoverflow.com/questions/1119385/junit-test-for-system-out-println

Extra notes

Let me know if the coverage is not good enough and I can add more usecases to the tests, these tests are just covering the "happy path". Also I did not test every permutation of options.