Conversation
Update `Version` to wrap `PomProperties`
| properties.load(is); | ||
| } catch (final IOException | NullPointerException e) { | ||
| final Logger logger = Logger.getLogger(PomProperties.class.getName()); | ||
| logger.warning("Failed to load properties file: " + PROPERTIES_FILE_PATH); |
There was a problem hiding this comment.
This should never occur, as far as I'm aware. However, I thought it better to warn developers about the failure rather than silently ignoring/handling it as the original implementation did.
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class PomPropertiesTest { |
There was a problem hiding this comment.
These tests could be more thorough, but we would need to do some ugly mocking of the getResourceAsStream function to pass-in an InputStream with test data. I can implement this if we want, but I'm open to other suggestions if there's a more straight forward way to pass in test data to the PomProperties.loadProperties() function.
| * You acknowledge that this software is not designed or intended for use in the | ||
| * design, construction, operation or maintenance of any nuclear facility. | ||
| */ | ||
|
|
There was a problem hiding this comment.
This seemed okay to remove as the class was totally rewritten.
| return INSTANCE.properties.getProperty("groupId"); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Are we using semantic versioning? I could omit most of this JavaDoc and instead point a link to some other page which explains things
…API/src/test/java`
The primary goal of this was to cache the result of
Version.getVersion(), so that we do not reload the value from the JAR whenevergetVersion()is called.As we were already loading the entire
pom.propertiesfile, I created a class to load and expose all available values from that file. TheVersionclass was then rewritten as a wrapper, for backwards compatibility, to use the newPomPropertiesclass.