|
6 | 6 | import static de.bsi.secvisogram.csaf_cms_backend.json.VersioningType.Integer; |
7 | 7 | import static de.bsi.secvisogram.csaf_cms_backend.json.VersioningType.Semantic; |
8 | 8 | import static org.hamcrest.MatcherAssert.assertThat; |
9 | | -import static org.hamcrest.Matchers.*; |
| 9 | +import static org.hamcrest.Matchers.equalTo; |
| 10 | +import static org.hamcrest.Matchers.is; |
| 11 | +import static org.hamcrest.Matchers.nullValue; |
| 12 | +import static org.hamcrest.Matchers.startsWith; |
10 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; |
11 | 14 | import static org.junit.jupiter.api.Assertions.assertThrows; |
12 | 15 |
|
|
23 | 26 | import java.nio.charset.StandardCharsets; |
24 | 27 | import java.time.Instant; |
25 | 28 | import java.time.LocalDate; |
| 29 | +import java.time.ZonedDateTime; |
26 | 30 | import java.time.format.DateTimeFormatter; |
| 31 | +import java.time.temporal.ChronoField; |
27 | 32 | import java.util.ArrayList; |
28 | 33 | import java.util.List; |
29 | 34 | import java.util.stream.Stream; |
|
33 | 38 | import org.junit.jupiter.params.provider.MethodSource; |
34 | 39 | import org.springframework.http.HttpStatus; |
35 | 40 |
|
| 41 | + |
36 | 42 | public class AdvisoryWrapperTest { |
37 | 43 |
|
38 | 44 | @Test |
@@ -592,9 +598,9 @@ public void setFinalTrackingIdTest() throws IOException, CsafException { |
592 | 598 | AdvisoryWrapper advisory = AdvisoryWrapper.createNewFromCsaf(csafToRequest(csafJsonWithReleaseDate), "Mustermann", Semantic.name()); |
593 | 599 | advisory.setTemporaryTrackingId("tempExamle", "7", 123L); |
594 | 600 | advisory.setFinalTrackingIdAndUrl("https://example.com", "example", "5", 158L); |
595 | | - |
596 | | - assertEquals("example-2023-00158", advisory.getDocumentTrackingId()); |
597 | | - assertEquals("https://example.com/WHITE/2023/example-2023-00158.json", advisory.at("/csaf/document/references/0/url").asText()); |
| 601 | + long year = ZonedDateTime.now().getYear(); |
| 602 | + assertEquals("example-" + year + "-00158", advisory.getDocumentTrackingId()); |
| 603 | + assertEquals("https://example.com/WHITE/" + year + "/example-" + year + "-00158.json", advisory.at("/csaf/document/references/0/url").asText()); |
598 | 604 | assertEquals("URL generated by system", advisory.at("/csaf/document/references/0/summary").asText()); |
599 | 605 | assertEquals("self", advisory.at("/csaf/document/references/0/category").asText()); |
600 | 606 | assertEquals("tempExamle-TEMP-0000123", advisory.getTempTrackingIdInFromMeta()); |
|
0 commit comments