Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

Commit 0571573

Browse files
committed
Use LocalDateTime instead of deprecated Date constructor
1 parent 0404656 commit 0571573

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

scb-engine/src/test/java/io/securecodebox/engine/execution/DefaultScanProcessExecutionTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import org.mockito.MockitoAnnotations;
3939
import org.mockito.stubbing.Answer;
4040

41+
import java.time.LocalDate;
42+
import java.time.LocalDateTime;
43+
import java.time.ZoneOffset;
4144
import java.util.Date;
4245
import java.util.Optional;
4346
import java.util.UUID;
@@ -54,7 +57,7 @@
5457
*/
5558
public class DefaultScanProcessExecutionTest {
5659

57-
private static final String DEFAULT_EXECUTION = "{\"id\":\"5a4e9d37-09b0-4109-badd-d79dfa8fce2a\",\"context\":\"TEST_CONTEXT\",\"automated\":false,\"scanners\":[{\"id\":\"62fa8ffb-e3bc-433e-b322-9c02108c5171\",\"type\":\"Test_SCANNER\",\"findings\":[{\"id\":\"49bf7fd3-8512-4d73-a28f-608e493cd726\",\"name\":\"BAD_TEST_FINDIG\",\"description\":\"Some coder has tested this!\",\"category\":\"COOL_TEST_STUFF\",\"osi_layer\":\"NOT_APPLICABLE\",\"severity\":\"HIGH\",\"reference\":{\"id\":\"UNI_CODE_STUFF\",\"source\":\"RISCOOL\"},\"hint\":\"You might wan't to blame Rüdiger!\",\"attributes\":{\"TEST\":\"Kekse\",\"HORRIBLE\":\"Coke\"},\"location\":\"mett.brot.securecodebox.io\",\"false_positive\":false}],\"rawFindings\":\"[{\\\"pudding\\\":\\\"Bier\\\"}]\"}],\"startDate\":61514978400000,\"endDate\":61514978400000,\"durationInMilliSeconds\":0}";
60+
private static final String DEFAULT_EXECUTION = "{\"id\":\"5a4e9d37-09b0-4109-badd-d79dfa8fce2a\",\"context\":\"TEST_CONTEXT\",\"automated\":false,\"scanners\":[{\"id\":\"62fa8ffb-e3bc-433e-b322-9c02108c5171\",\"type\":\"Test_SCANNER\",\"findings\":[{\"id\":\"49bf7fd3-8512-4d73-a28f-608e493cd726\",\"name\":\"BAD_TEST_FINDIG\",\"description\":\"Some coder has tested this!\",\"category\":\"COOL_TEST_STUFF\",\"osi_layer\":\"NOT_APPLICABLE\",\"severity\":\"HIGH\",\"reference\":{\"id\":\"UNI_CODE_STUFF\",\"source\":\"RISCOOL\"},\"hint\":\"You might wan't to blame Rüdiger!\",\"attributes\":{\"TEST\":\"Kekse\",\"HORRIBLE\":\"Coke\"},\"location\":\"mett.brot.securecodebox.io\",\"false_positive\":false}],\"rawFindings\":\"[{\\\"pudding\\\":\\\"Bier\\\"}]\"}],\"startDate\":504295320000,\"endDate\":504295620000,\"durationInMilliSeconds\":300000}";
5861
public static final String SCANNER_SERIALIZE_RESULT = "{\"id\":\"62fa8ffb-e3bc-433e-b322-9c02108c5171\",\"type\":\"Test_SCANNER\",\"findings\":[{\"id\":\"49bf7fd3-8512-4d73-a28f-608e493cd726\",\"name\":\"BAD_TEST_FINDIG\",\"description\":\"Some coder has tested this!\",\"category\":\"COOL_TEST_STUFF\",\"osi_layer\":\"NOT_APPLICABLE\",\"severity\":\"HIGH\",\"reference\":{\"id\":\"UNI_CODE_STUFF\",\"source\":\"RISCOOL\"},\"hint\":\"You might wan't to blame Rüdiger!\",\"attributes\":{\"TEST\":\"Kekse\",\"HORRIBLE\":\"Coke\"},\"location\":\"mett.brot.securecodebox.io\",\"false_positive\":false}],\"rawFindings\":\"[{\\\"pudding\\\":\\\"Bier\\\"}]\"}";
5962

6063
String findingCache = "";
@@ -78,8 +81,12 @@ public void setUp() {
7881

7982
objectMapper.registerModule(new Jdk8Module());
8083

81-
when(executionTimeService.getStartDate()).thenReturn(new Date(2019, 4, 3));
82-
when(executionTimeService.getEndDate()).thenReturn(Optional.of(new Date(2019, 4, 3)));
84+
when(executionTimeService.getStartDate()).thenReturn(
85+
Date.from(LocalDateTime.of(1985, 12, 24, 18, 2).toInstant(ZoneOffset.UTC))
86+
);
87+
when(executionTimeService.getEndDate()).thenReturn(Optional.of(
88+
Date.from(LocalDateTime.of(1985, 12, 24, 18, 7).toInstant(ZoneOffset.UTC))
89+
));
8390
underTest.executionTimeService = executionTimeService;
8491

8592
when(processExecutionFactory.get(execution)).thenReturn(underTest);

0 commit comments

Comments
 (0)