Skip to content

Commit 5b6b09d

Browse files
committed
some forgotten thingies from scalatest switch
1 parent a7abdac commit 5b6b09d

File tree

1 file changed

+8
-7
lines changed
  • core/src/test/scala/chargepoint/docile/dsl/ocpp20transactions

1 file changed

+8
-7
lines changed

core/src/test/scala/chargepoint/docile/dsl/ocpp20transactions/OpsSpec.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import org.scalatest.flatspec.AnyFlatSpec
1111
class OpsSpec extends AnyFlatSpec {
1212

1313
"ocpp20transactions.Ops" should "generate a transaction UUID on transaction start" in {
14-
val (tx, _) = ops.startTransactionAtCablePluggedIn()
14+
val (tx, _) = ops().startTransactionAtCablePluggedIn()
1515

16-
assert(tx.data.id === "\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}")
16+
assert(tx.data.id.matches("\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}"))
1717
}
1818

1919
it should "return transaction messages with incrementing sequence numbers" in {
20-
val (tx, req0) = ops.startTransactionAtCablePluggedIn()
20+
val (tx, req0) = ops().startTransactionAtCablePluggedIn()
2121

2222
val req1 = tx.startEnergyOffer()
2323
val req2 = tx.end()
@@ -26,26 +26,27 @@ class OpsSpec extends AnyFlatSpec {
2626
}
2727

2828
it should "return transaction messages with incrementing sequence numbers over multiple transactions" in {
29-
val (tx0, req0) = ops.startTransactionAtCablePluggedIn()
29+
val myOps = ops()
30+
val (tx0, req0) = myOps.startTransactionAtCablePluggedIn()
3031

3132
val req1 = tx0.end()
3233

33-
val (tx1, req2) = ops.startTransactionAtAuthorized()
34+
val (tx1, req2) = myOps.startTransactionAtAuthorized()
3435

3536
val req3 = tx1.end()
3637

3738
assert(List(req0, req1, req2, req3).map(_.seqNo) === 0.to(3).toList)
3839
}
3940

4041
it should "specify the EVSE and connector ID on the first message, and not later" in {
41-
val (tx, req0) = ops.startTransactionAtAuthorized(evseId = 2, connectorId = 3)
42+
val (tx, req0) = ops().startTransactionAtAuthorized(evseId = 2, connectorId = 3)
4243

4344
val req1 = tx.plugInCable()
4445

4546
assert((req0.evse, req1.evse) === ((Some(EVSE(2, Some(3))), None)))
4647
}
4748

48-
val ops = new CoreOps[
49+
def ops(): Ops = new CoreOps[
4950
VersionFamily.V20.type,
5051
CsmsRequest,
5152
CsmsResponse,

0 commit comments

Comments
 (0)