use of org.jreleaser.model.VersionPattern in project jreleaser by jreleaser.
the class ChangelogGeneratorUnitTest method doNecessaryMock.
private LogCommand doNecessaryMock(String effectiveTagName, String configuredTagName, ObjectId headId, boolean isSnapshot, List<Ref> tagRefs) throws GitAPIException, IOException {
ListTagCommand listTagCommand = mock(ListTagCommand.class);
JReleaserModel model = mock(JReleaserModel.class);
when(context.getModel()).thenReturn(model);
Project project = mock(Project.class);
when(model.getProject()).thenReturn(project);
Release release = mock(Release.class);
when(model.getRelease()).thenReturn(release);
VersionPattern versionPattern = mock(VersionPattern.class);
when(versionPattern.getType()).thenReturn(VersionPattern.Type.SEMVER);
when(project.versionPattern()).thenReturn(versionPattern);
LogCommand logCommand = mock(LogCommand.class, RETURNS_DEEP_STUBS);
when(git.log()).thenReturn(logCommand);
when(listTagCommand.call()).thenReturn(tagRefs);
when(git.tagList()).thenReturn(listTagCommand);
GitService gitService = mock(GitService.class, RETURNS_DEEP_STUBS);
when(release.getGitService()).thenReturn(gitService);
when(gitService.getEffectiveTagName(any())).thenReturn(effectiveTagName);
when(gitService.getConfiguredTagName()).thenReturn(configuredTagName);
when(git.getRepository().resolve(Constants.HEAD)).thenReturn(headId);
doReturn(SemVer.of(effectiveTagName)).when(project).version();
when(context.getModel().getProject().isSnapshot()).thenReturn(isSnapshot);
return logCommand;
}
Aggregations