Search in sources :

Example 1 with VersionPattern

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;
}
Also used : Project(org.jreleaser.model.Project) VersionPattern(org.jreleaser.model.VersionPattern) LogCommand(org.eclipse.jgit.api.LogCommand) JReleaserModel(org.jreleaser.model.JReleaserModel) GitService(org.jreleaser.model.GitService) ListTagCommand(org.eclipse.jgit.api.ListTagCommand) Release(org.jreleaser.model.Release)

Aggregations

ListTagCommand (org.eclipse.jgit.api.ListTagCommand)1 LogCommand (org.eclipse.jgit.api.LogCommand)1 GitService (org.jreleaser.model.GitService)1 JReleaserModel (org.jreleaser.model.JReleaserModel)1 Project (org.jreleaser.model.Project)1 Release (org.jreleaser.model.Release)1 VersionPattern (org.jreleaser.model.VersionPattern)1