Upgrade to Mockito 3.4.6
Closes gh-22838
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,10 +28,11 @@ import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.boot.loader.tools.Library;
|
||||
import org.springframework.boot.loader.tools.LibraryCallback;
|
||||
@@ -48,6 +49,7 @@ import static org.mockito.Mockito.verify;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ArtifactsLibrariesTests {
|
||||
|
||||
@Mock
|
||||
@@ -70,17 +72,15 @@ class ArtifactsLibrariesTests {
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
this.artifacts = Collections.singleton(this.artifact);
|
||||
this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class));
|
||||
given(this.artifact.getFile()).willReturn(this.file);
|
||||
given(this.artifactHandler.getExtension()).willReturn("jar");
|
||||
given(this.artifact.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
}
|
||||
|
||||
@Test
|
||||
void callbackForJars() throws Exception {
|
||||
given(this.artifact.getType()).willReturn("jar");
|
||||
given(this.artifact.getFile()).willReturn(this.file);
|
||||
given(this.artifact.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
given(this.artifact.getScope()).willReturn("compile");
|
||||
this.libs.doWithLibraries(this.callback);
|
||||
verify(this.callback).library(this.libraryCaptor.capture());
|
||||
@@ -92,9 +92,10 @@ class ArtifactsLibrariesTests {
|
||||
|
||||
@Test
|
||||
void callbackWithUnpack() throws Exception {
|
||||
given(this.artifact.getFile()).willReturn(this.file);
|
||||
given(this.artifact.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
given(this.artifact.getGroupId()).willReturn("gid");
|
||||
given(this.artifact.getArtifactId()).willReturn("aid");
|
||||
given(this.artifact.getType()).willReturn("jar");
|
||||
given(this.artifact.getScope()).willReturn("compile");
|
||||
Dependency unpack = new Dependency();
|
||||
unpack.setGroupId("gid");
|
||||
@@ -109,14 +110,12 @@ class ArtifactsLibrariesTests {
|
||||
void renamesDuplicates() throws Exception {
|
||||
Artifact artifact1 = mock(Artifact.class);
|
||||
Artifact artifact2 = mock(Artifact.class);
|
||||
given(artifact1.getType()).willReturn("jar");
|
||||
given(artifact1.getScope()).willReturn("compile");
|
||||
given(artifact1.getGroupId()).willReturn("g1");
|
||||
given(artifact1.getArtifactId()).willReturn("artifact");
|
||||
given(artifact1.getBaseVersion()).willReturn("1.0");
|
||||
given(artifact1.getFile()).willReturn(new File("a"));
|
||||
given(artifact1.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
given(artifact2.getType()).willReturn("jar");
|
||||
given(artifact2.getScope()).willReturn("compile");
|
||||
given(artifact2.getGroupId()).willReturn("g2");
|
||||
given(artifact2.getArtifactId()).willReturn("artifact");
|
||||
|
||||
Reference in New Issue
Block a user