|
1 | 1 | package io.cucumber.core.runtime; |
2 | 2 |
|
3 | | -import io.cucumber.cienvironment.CiEnvironment; |
4 | 3 | import io.cucumber.core.eventbus.EventBus; |
5 | 4 | import io.cucumber.core.gherkin.Feature; |
6 | 5 | import io.cucumber.core.logging.Logger; |
@@ -65,27 +64,17 @@ private Meta createMeta() { |
65 | 64 | new Product(System.getProperty("java.vm.name"), System.getProperty("java.vm.version")), |
66 | 65 | new Product(System.getProperty("os.name"), null), |
67 | 66 | new Product(System.getProperty("os.arch"), null), |
68 | | - createCi()); |
69 | | - } |
70 | | - |
71 | | - private Ci createCi() { |
72 | | - CiEnvironment ciEnvironment = detectCiEnvironment(System.getenv()); |
73 | | - if (ciEnvironment == null) { |
74 | | - return null; |
75 | | - } |
76 | | - |
77 | | - return new Ci( |
78 | | - ciEnvironment.getName(), |
79 | | - ciEnvironment.getUrl(), |
80 | | - ciEnvironment.getBuildNumber(), |
81 | | - createGit(ciEnvironment.getGit())); |
82 | | - } |
83 | | - |
84 | | - private Git createGit(CiEnvironment.Git ciGit) { |
85 | | - if (ciGit == null) { |
86 | | - return null; |
87 | | - } |
88 | | - return new Git(ciGit.getRemote(), ciGit.getRevision(), ciGit.getBranch(), ciGit.getTag()); |
| 67 | + detectCiEnvironment(System.getenv()).map(ci -> new Ci( |
| 68 | + ci.getName(), |
| 69 | + ci.getUrl(), |
| 70 | + ci.getBuildNumber().orElse(null), |
| 71 | + ci.getGit().map(git -> new Git( |
| 72 | + git.getRemote(), |
| 73 | + git.getRevision(), |
| 74 | + git.getBranch().orElse(null), |
| 75 | + git.getTag().orElse(null))) |
| 76 | + .orElse(null))) |
| 77 | + .orElse(null)); |
89 | 78 | } |
90 | 79 |
|
91 | 80 | private void emitTestRunStarted() { |
|
0 commit comments