Overview
StarCraftTest.testPlanet fails intermittently because the shared regex
^(?! )[A-Za-z0-9' ]*(?<! )$ does not include hyphens (-), but
starcraft.yml contains at least two hyphenated planet names:
The test is probabilistic — it only fails when the random draw picks one of
those two planets — explaining why it wasn't caught earlier.
Root cause
The regex in StarCraftTest.java:9 was written to cover the original planet
data, which had no hyphens. The hyphenated names were introduced with the
upstream starcraft.yml data and were never reflected in the test.
Fix
File: src/test/java/org/thejavaguy/javafaker/StarCraftTest.java
Update the shared regex field to include a literal hyphen (placed at the end of
the character class, which is the conventional position to avoid ambiguity with
ranges):
// Before
private final String noLeadingTrailingWhitespaceRegex = "^(?! )[A-Za-z0-9' ]*(?<! )$";
// After
private final String noLeadingTrailingWhitespaceRegex = "^(?! )[A-Za-z0-9' -]*(?<! )$";
No YAML data changes needed — the hyphenated names are valid planet identifiers.
Overview
StarCraftTest.testPlanetfails intermittently because the shared regex^(?! )[A-Za-z0-9' ]*(?<! )$does not include hyphens (-), butstarcraft.ymlcontains at least two hyphenated planet names:"G-2275""LV-555"The test is probabilistic — it only fails when the random draw picks one of
those two planets — explaining why it wasn't caught earlier.
Root cause
The regex in
StarCraftTest.java:9was written to cover the original planetdata, which had no hyphens. The hyphenated names were introduced with the
upstream
starcraft.ymldata and were never reflected in the test.Fix
File:
src/test/java/org/thejavaguy/javafaker/StarCraftTest.javaUpdate the shared regex field to include a literal hyphen (placed at the end of
the character class, which is the conventional position to avoid ambiguity with
ranges):
No YAML data changes needed — the hyphenated names are valid planet identifiers.