Skip to content

Commit 58fdab8

Browse files
authored
Merge pull request #782 from TomRose/feature/caseinsensitivestringcomparison
Feature/caseinsensitivestringcomparison
2 parents ba2245e + 3bc43e4 commit 58fdab8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}

0 commit comments

Comments
 (0)