Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

rahul0208
Copy link

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>


def 'Has a default constructor used with injection in Maven'() {
given:
def subjectUnderTest = new SuffixVersionPolicy()

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);

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;

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")

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")

@rahul0208
Copy link
Author

I have fixed the feedback.

@rahul0208
Copy link
Author

@leonard84 I think all feedback is fixed on this one. Let me know if I missed anything

@leonard84
Copy link

@rahul0208 Please remove redundant ; in this file is still open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants