From 6b6dd85769b917b9445846b189eed2520a7f0472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Del=C3=A8gue?= Date: Mon, 7 Oct 2024 10:41:58 +0200 Subject: [PATCH] Move to play 3 / pekko --- .../controllers/OrganisationControllerSpec.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nio-server/test/controllers/OrganisationControllerSpec.scala b/nio-server/test/controllers/OrganisationControllerSpec.scala index bc29b42..6e126a6 100644 --- a/nio-server/test/controllers/OrganisationControllerSpec.scala +++ b/nio-server/test/controllers/OrganisationControllerSpec.scala @@ -1,12 +1,14 @@ package controllers import models._ -import java.time.{LocalDateTime, Clock} -import utils.NioLogger + +import java.time.{Clock, LocalDateTime} +import utils.{DateUtils, NioLogger, TestUtils} import play.api.libs.json.{JsArray, JsValue, Json} import play.api.libs.ws.WSResponse import play.api.test.Helpers._ -import utils.TestUtils + +import java.time.format.DateTimeFormatter class OrganisationControllerSpec extends TestUtils { @@ -103,7 +105,7 @@ class OrganisationControllerSpec extends TestUtils { (value \ "version" \ "latest").as[Boolean] mustBe org1.version.latest (value \ "version" \ "neverReleased").asOpt[Boolean] mustBe None (value \ "version" \ "lastUpdate").asOpt[String].map { s => - val lastUpdate = LocalDateTime.parse(s) + val lastUpdate = LocalDateTime.parse(s, DateUtils.utcDateFormatter) lastUpdate.isAfter(beforeNewOrgCreation) && lastUpdate.isBefore(LocalDateTime.now(Clock.systemUTC).plusSeconds(1)) } mustBe Some(true) @@ -134,7 +136,7 @@ class OrganisationControllerSpec extends TestUtils { (organisations \ 1 \ "version" \ "status").as[String] mustBe "DRAFT" (organisations \ 1 \ "version" \ "num").as[Int] mustBe 1 (organisations \ 1 \ "version" \ "lastUpdate").asOpt[String].map { s => - val lastUpdate = LocalDateTime.parse(s) + val lastUpdate = LocalDateTime.parse(s, DateUtils.utcDateFormatter) lastUpdate.isAfter(beforeNewOrgCreation) && lastUpdate.isBefore(LocalDateTime.now(Clock.systemUTC).plusSeconds(1)) } mustBe Some(true) } @@ -186,7 +188,7 @@ class OrganisationControllerSpec extends TestUtils { (value \ "version" \ "status").as[String] mustBe "RELEASED" (value \ "version" \ "num").as[Int] mustBe org1.version.num (value \ "version" \ "lastUpdate").asOpt[String].map { s => - val lastUpdate = LocalDateTime.parse(s) + val lastUpdate = LocalDateTime.parse(s, DateUtils.utcDateFormatter) lastUpdate.isBefore(LocalDateTime.now(Clock.systemUTC).plusSeconds(1)) } mustBe Some(true) }