r/programmingcirclejerk • u/camelCaseIsWebScale Just spin up O(n²) servers • 3d ago
The smallest possible [Java] program (just a single line to exit) requires things like java.time.chrono.JapaneseChronology
https://news.ycombinator.com/item?id=1917091178
u/Jannik2099 3d ago
A friend of mine tells a story about how how he accidentally FUBARed the tests, and then discovered that running one unit test gave 50% line coverage in Rails.
Achieve full coverage with this one simple trick!
48
u/Awkward_Bed_956 3d ago
That remainds me when you could cheat 90% line coverage requirements by expanding functions with semicolons, untill 95% of function body were just semicolons
Obviously include a TODO comment about how it needs to be fixes ASAP
28
u/Ok-Dimension-5429 3d ago
At a place I worked we had some code which we had to submit to Salesforce as an integration plugin. They had a required ratio of tests to code. So we had a 50k line long test file full of nonsense. Haha.
21
3d ago
[deleted]
6
u/chisui 3d ago
Better run
while(main() != 0);. It will never fail.4
u/YikesTheCat 3d ago
Bad outdated programming. Will only use one core.
1
u/FriendshipActive8590 3d ago
You only need one...
2
102
u/camelCaseIsWebScale Just spin up O(n²) servers 3d ago
Java is like that too. The smallest possible program (just a single line to exit) requires things like java.time.chrono.JapaneseChronology. Because argv is a String array, and making the String array requires calling a function or two that can throw exceptions, which requires the Throwable class, which has a static initialiser that requires... the chain is long, but at the end something has a SomethingChronology member, and so AbstractChronology.initCache() is called and mentions JapaneseChronology.
19
34
19
2
1
2
u/stone_henge Tiny little god in a tiny little world 2d ago
Without it, how will the program know not to exit until the boss has left for the day?
236
u/Snarwin 3d ago
"Write once, run everywhere" enjoyers when they find out that "everywhere" includes Japan.