3838import org .mockito .MockitoAnnotations ;
3939import org .mockito .stubbing .Answer ;
4040
41+ import java .time .LocalDate ;
42+ import java .time .LocalDateTime ;
43+ import java .time .ZoneOffset ;
4144import java .util .Date ;
4245import java .util .Optional ;
4346import java .util .UUID ;
5457 */
5558public 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