File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
scala-test/src/test/scala-2/com/baeldung/scala/scalatest/stringtest Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .baeldung .scala .scalatest .stringtest
2
+
3
+ import org .scalatest .flatspec .AnyFlatSpec
4
+ import org .scalatest .matchers .should .Matchers
5
+
6
+ class CaseInsensitiveStringComparisonUnitTest
7
+ extends AnyFlatSpec
8
+ with Matchers {
9
+ " operating equals ignore case method on a string" should " return true if strings are the same when ignoring case" in {
10
+ val str = " Hello World"
11
+ val result = str.equalsIgnoreCase(" hello world" )
12
+
13
+ result should be(true )
14
+ }
15
+
16
+ " operating toLowerCase.contains on a string" should " return if strings are the same when ignoring case" in {
17
+ val str = " Hello World"
18
+ val result = str.toLowerCase.contains(" hello" .toLowerCase)
19
+
20
+ result should be(true )
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments