|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
17 | 17 | package org.springframework.boot.maven;
|
18 | 18 |
|
19 | 19 | import java.io.File;
|
| 20 | +import java.io.IOException; |
20 | 21 | import java.util.Arrays;
|
21 | 22 | import java.util.Collections;
|
22 | 23 | import java.util.LinkedHashSet;
|
@@ -131,4 +132,20 @@ void renamesDuplicates() throws Exception {
|
131 | 132 | assertThat(this.libraryCaptor.getAllValues().get(1).getName()).isEqualTo("g2-artifact-1.0.jar");
|
132 | 133 | }
|
133 | 134 |
|
| 135 | + @Test |
| 136 | + void libraryCoordinatesVersionUsesBaseVersionOfArtifact() throws IOException { |
| 137 | + Artifact snapshotArtifact = mock(Artifact.class); |
| 138 | + given(snapshotArtifact.getType()).willReturn("jar"); |
| 139 | + given(snapshotArtifact.getScope()).willReturn("compile"); |
| 140 | + given(snapshotArtifact.getGroupId()).willReturn("g1"); |
| 141 | + given(snapshotArtifact.getArtifactId()).willReturn("artifact"); |
| 142 | + given(snapshotArtifact.getVersion()).willReturn("1.0-20200929.090327-28"); |
| 143 | + given(snapshotArtifact.getBaseVersion()).willReturn("1.0-SNAPSHOT"); |
| 144 | + given(snapshotArtifact.getFile()).willReturn(new File("a")); |
| 145 | + given(snapshotArtifact.getArtifactHandler()).willReturn(this.artifactHandler); |
| 146 | + this.artifacts = Collections.singleton(snapshotArtifact); |
| 147 | + new ArtifactsLibraries(this.artifacts, null, mock(Log.class)).doWithLibraries( |
| 148 | + (library) -> assertThat(library.getCoordinates().getVersion()).isEqualTo("1.0-SNAPSHOT")); |
| 149 | + } |
| 150 | + |
134 | 151 | }
|
0 commit comments