]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
[NO JIRA] Fix Its (#135)
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 10 Oct 2022 06:12:39 +0000 (01:12 -0500)
committerGitHub <noreply@github.com>
Mon, 10 Oct 2022 06:12:39 +0000 (08:12 +0200)
it/src/test/java/com/sonarsource/scanner/it/ScannerTestCase.java

index 580463945eab83c42afaeb9871273d440f1a9e96..be96a0619ce0a340b8e41f204a1a51b6460999b3 100644 (file)
@@ -26,10 +26,10 @@ import com.sonar.orchestrator.version.Version;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.time.Instant;
+import java.time.LocalDateTime;
 import java.time.ZoneId;
+import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -56,6 +56,8 @@ import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 
 public abstract class ScannerTestCase {
+  private static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
+  private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern(DATETIME_FORMAT);
 
   private static final Logger LOG = LoggerFactory
     .getLogger(ScannerTestCase.class);
@@ -94,10 +96,7 @@ public abstract class ScannerTestCase {
 
   @After
   public void resetData() {
-    // The expected format is yyyy-MM-dd.
-    String currentDateTime = DateTimeFormatter.ISO_LOCAL_DATE
-      .withZone(ZoneId.of("UTC"))
-      .format(Instant.now());
+    String currentDateTime = ZonedDateTime.now().format(DATETIME_FORMATTER);
 
     orchestrator.getServer()
       .newHttpCall("/api/projects/bulk_delete")