File tree Expand file tree Collapse file tree 2 files changed +33
-12
lines changed
scala-core-modules/scala-core/src/test/scala-3/com/baeldung/scala/patternmatching Expand file tree Collapse file tree 2 files changed +33
-12
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package com .baeldung .scala .patternmatching
2
+
3
+ import org .scalatest .flatspec .AnyFlatSpec
4
+ import org .scalatest .matchers .should .Matchers
5
+
6
+ class MultipleMatchesUnitTest extends AnyFlatSpec with Matchers {
7
+
8
+ " executeCommand" should " start the system when given the command" in {
9
+ val result = executeCommand(Start )
10
+ result shouldEqual " System Starting."
11
+ }
12
+
13
+ it should " stop the system when given the command" in {
14
+ val result = executeCommand(CustomCommand (" halt" ))
15
+ result shouldEqual " System Stopping."
16
+ }
17
+
18
+ " httpResponse" should " Error" in {
19
+ val result = httpResponse(404 )
20
+ result shouldEqual " Error"
21
+ }
22
+
23
+ " multipleTypePatterns" should " Error" in {
24
+ val result = multipleTypePatterns(4.4 )
25
+ result shouldEqual " It's something else"
26
+ }
27
+
28
+ " unionTypePattern" should " Error" in {
29
+ val result = unionTypePattern(42 )
30
+ result shouldEqual " It's either a String or an Int"
31
+ }
32
+
33
+ }
You can’t perform that action at this time.
0 commit comments