cowtowncoder / java-uuid-generator

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

feat(test): cowtowncoder#87 added a new test for LockedFile #110

Closed SquireOfSoftware closed 3 months ago

SquireOfSoftware commented 3 months ago

What did I do?

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

Extra notes

There were also some cool things that I discovered:

Let me know if the coverage is not good enough and I can add more usecases to the tests

cowtowncoder commented 3 months ago

First of all, thank you for submitting this! While I am not a big fan of super-extensive testing for purposes of code coverage, it is cool to get some coverage for this helper class. So that's good. I only added one quick note on things I do not really want spent any time on (argument validation for internal helper classes).

On

A cool feature that I discovered is that the constructor will create files for you even if they do not exist

yeah, in hindsight I think that is slightly wrong (my fault obviously :) ) -- constructors should not typically do such heavy lifting. But I wrote JUG 20 years ago so... live & learn :) (it's just a matter of keeping such logic in factory method, IMHO, nothing more special; constructors should only contain argument validation, assignments, nothing else)

cowtowncoder commented 3 months ago

@SquireOfSoftware well done! Code coverage (line coverage, I think?) shot up by 5% pct units, now well over 50% overall.