-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove static methods in initializr-metadata's public API that are only used in tests #956
Comments
For the record, this was introduced when we migrated from Groovy to Java and such "overloaded constructors" were given to us for free.
|
Thanks for the background info. Good to hear this sort of thing is heading in the right direction. Bom creation could look something like this perhaps: BillOfMaterials fooBom = MetadataBuilder.bomWithCoordinates("org.foo", "bom",
(bom) -> bom
.mappingWithRange("[1.0.0.RELEASE, 1.1.8.RELEASE)", (mapTo) -> mapTo.version("1.0.0.RELEASE"))
.mappingWithRange("1.1.8.RELEASE", (mapTo) -> mapTo.version("2.0.0.RELEASE"))); |
And a slightly more complex example: BillOfMaterials exampleBom = MetadataBuilder.bomWithCoordinates("com.example", "bom", (bom) -> bom
.version("1.0.0").versionProperty("bom.version").repository("repo-main").additionalBom("bom-main")
.mappingWithRange("[1.2.0.RELEASE,1.3.0.M1)",
(mapTo) -> mapTo.version("1.1.0").groupId("com.example.override").artifactId("bom-override"))); |
Interesting, thank you. One more thing to consider before spending efforts on this. If we keep a |
The
initializr-metadata
module has some public API that is only used in tests. It'd be nice to reduce the public API and pull those methods out into something that is test-specific. That might be a-test-support
module similar to what we have in Spring Boot.Some methods that are candidates for removal from the public API:
io.spring.initializr.metadata.BillOfMaterials.create(String, String)
io.spring.initializr.metadata.BillOfMaterials.create(String, String, String)
io.spring.initializr.metadata.BillOfMaterials.Mapping.create(String, String)
io.spring.initializr.metadata.BillOfMaterials.Mapping.create(String, String, String...)
io.spring.initializr.metadata.Dependency.create(String, String, String, String)
io.spring.initializr.metadata.Dependency.withId(String, String)
io.spring.initializr.metadata.Dependency.withId(String, String, String, String)
io.spring.initializr.metadata.Dependency.withId(String, String, String, String, String)
io.spring.initializr.metadata.Dependency.Mapping.create(String, String, String, String, Boolean)
Of the methods listed above, one of them is used by tests in start.spring.io. We could consider a published test module or copy and paste as the usage is pretty minimal.
There's also a mixture of overloading (
Dependency.withId
) and methods that may be called with severalnulls
(Dependency.Mapping.create
). It'd be nice to be consistent and I wonder if a builder-based approach might work quite well here.The text was updated successfully, but these errors were encountered: