26
26
import java.nio.file.Paths;
27
27
import java.util.Optional;
28
28
29
+
import static io.qameta.allure.bamboo.AllureExecutableProvider.BIN;
29
30
import static io.qameta.allure.bamboo.AllureExecutableProvider.DEFAULT_VERSION;
30
-
import static io.qameta.allure.bamboo.AllureExecutableProvider.getAllureSubDir;
31
31
import static org.mockito.ArgumentMatchers.anyString;
32
32
import static org.mockito.Mockito.verify;
33
33
import static org.mockito.Mockito.when;
34
34
import static org.mockito.junit.MockitoJUnit.rule;
35
35
36
36
public class AllureExecutableProviderTest {
37
37
38
-
private static final String ALLURE_2_0_0 = "Allure 2.0.0";
39
-
private static final String EXECUTABLE_NAME_2_0_0 = "2.0.0";
40
-
private static final String BIN = "bin";
38
+
private static final String ALLURE_2_21_0 = "Allure 2.21.0";
39
+
private static final String EXECUTABLE_NAME_2_21_0 = "2.21.0";
41
40
private final String homeDir = "/home/allure";
42
-
private final String binaryDir = Paths.get(this.homeDir, getAllureSubDir()).toString();
43
41
44
42
@Rule
45
43
public MockitoRule mockitoRule = rule();
@@ -58,39 +56,39 @@ public class AllureExecutableProviderTest {
58
56
@Before
59
57
public void setUp() throws Exception {
60
58
config = new AllureGlobalConfig();
61
-
allureCmdPath = Paths.get(binaryDir, BIN, "allure");
62
-
allureBatCmdPath = Paths.get(binaryDir, BIN, "allure.bat");
59
+
allureCmdPath = Paths.get(homeDir, BIN, "allure");
60
+
allureBatCmdPath = Paths.get(homeDir, BIN, "allure.bat");
63
61
when(downloader.downloadAndExtractAllureTo(anyString(), anyString())).thenReturn(Optional.empty());
64
62
}
65
63
66
64
@Test
67
65
public void itShouldProvideDefaultVersion() throws Exception {
68
66
provide("Allure WITHOUT VERSION");
69
-
verify(downloader).downloadAndExtractAllureTo(binaryDir, DEFAULT_VERSION);
67
+
verify(downloader).downloadAndExtractAllureTo(homeDir, DEFAULT_VERSION);
70
68
}
71
69
72
70
@Test
73
71
public void itShouldProvideTheGivenVersionWithFullSemverWithoutName() throws Exception {
74
-
provide(EXECUTABLE_NAME_2_0_0);
75
-
verify(downloader).downloadAndExtractAllureTo(binaryDir, EXECUTABLE_NAME_2_0_0);
72
+
provide(EXECUTABLE_NAME_2_21_0);
73
+
verify(downloader).downloadAndExtractAllureTo(homeDir, EXECUTABLE_NAME_2_21_0);
76
74
}
77
75
78
76
@Test
79
77
public void itShouldProvideTheGivenVersionWithFullSemverWithoutMilestone() throws Exception {
80
-
provide(ALLURE_2_0_0);
81
-
verify(downloader).downloadAndExtractAllureTo(binaryDir, EXECUTABLE_NAME_2_0_0);
78
+
provide(ALLURE_2_21_0);
79
+
verify(downloader).downloadAndExtractAllureTo(homeDir, EXECUTABLE_NAME_2_21_0);
82
80
}
83
81
84
82
@Test
85
83
public void itShouldProvideTheGivenVersionWithMajorMinorWithoutMilestone() throws Exception {
86
-
provide("Allure 2.0");
87
-
verify(downloader).downloadAndExtractAllureTo(binaryDir, "2.0");
84
+
provide("Allure 2.13.7");
85
+
verify(downloader).downloadAndExtractAllureTo(homeDir, "2.13.7");
88
86
}
89
87
90
88
@Test
91
89
public void itShouldProvideTheGivenVersionWithMilestone() throws Exception {
92
90
provide("Allure 2.0-BETA4");
93
-
verify(downloader).downloadAndExtractAllureTo(binaryDir, "2.0-BETA4");
91
+
verify(downloader).downloadAndExtractAllureTo(homeDir, "2.0-BETA4");
94
92
}
95
93
96
94
private Optional<AllureExecutable> provide(String executableName) {
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4