-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding a SuffixVersionPolicy #13
base: master
Are you sure you want to change the base?
Conversation
…fixs based on project properties.
|
||
def 'Has a default constructor used with injection in Maven'() { | ||
given: | ||
def subjectUnderTest = new SuffixVersionPolicy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write this test as
when:
new SuffixVersionPolicy()
then:
noExceptionThrown()
since you want to assert that it passes without exception.
However I would make this an implicit assertion and put the SuffixVersionPolicy
and the mavenProject
as fields in this test, since they are repeated in every other setup block.
} | ||
final DefaultVersionInfo currentSnapshot = new DefaultVersionInfo(mavenProject.getVersion()); | ||
final VersionPolicyResult result = new VersionPolicyResult(); | ||
String buildNumberSuffix= projectProperties.getProperty(SUFFIX_IDENTIFIER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space before =
def subjectUnderTest = new SuffixVersionPolicy() | ||
|
||
expect: | ||
subjectUnderTest != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove redundant ;
in this file
setup : | ||
def subjectUnderTest = new SuffixVersionPolicy(); | ||
def mavenProject = createMavenProject(); | ||
mavenProject.getProperties().setProperty(SuffixVersionPolicy.SUFFIX_IDENTIFIER,".suffix") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mavenProject.getProperties().setProperty(SuffixVersionPolicy.SUFFIX_IDENTIFIER,".suffix")
can be replaced by
mavenProject.properties.setProperty(SuffixVersionPolicy.SUFFIX_IDENTIFIER,".suffix")
I have fixed the feedback. |
@leonard84 I think all feedback is fixed on this one. Let me know if I missed anything |
@rahul0208 |
The SuffixVersionPolicy can be used to add a custom suffix to the release version. The suffix part can be configured using
<version-suffix></version-suffix>
as maven project property. The policy can be used with existing maven project properties to generate version numbers.In our case, we need to append svn revision number to the project version. The revision number is generated using the buildnumber maven plugin. The plugin adds a
buildNumber
property to the project. The property is configure to generate the suffix as<version-suffix>-r$\{buildNumber}</version-suffix>