-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for
getOptionalStringSet
and getStringSet
from CommonCo…
…nfig
- Loading branch information
1 parent
8a5cd46
commit 93bcbb5
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
common-lib/src/test/scala/com/gu/mediaservice/lib/config/CommonConfigTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.gu.mediaservice.lib.config | ||
|
||
import org.mockito.Mockito.when | ||
import org.scalatest.funsuite.AnyFunSuiteLike | ||
import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper | ||
import org.scalatestplus.mockito.MockitoSugar | ||
import play.api.Configuration | ||
|
||
class CommonConfigTest extends AnyFunSuiteLike with MockitoSugar { | ||
|
||
private val commonConf = mock[CommonConfig] | ||
when(commonConf.configuration).thenReturn(Configuration( | ||
"setAsCommaSepString" -> "a, b,c", | ||
"setAsActualArray" -> Set("a", "b", "c") | ||
)) | ||
|
||
test("testGetOptionalStringSet") { | ||
commonConf.getOptionalStringSet("doesnt.exist") shouldBe None | ||
commonConf.getOptionalStringSet("setAsCommaSepString") shouldBe Some(Set("a", "b", "c")) | ||
commonConf.getOptionalStringSet("setAsActualArray") shouldBe Some(Set("a", "b", "c")) | ||
} | ||
|
||
test("testGetStringSet") { | ||
commonConf.getStringSet("doesnt.exist") shouldBe Set.empty | ||
commonConf.getStringSet("setAsCommaSepString") shouldBe Set("a", "b", "c") | ||
commonConf.getStringSet("setAsActualArray") shouldBe Set("a", "b", "c") | ||
} | ||
|
||
} |