Skip to content

Commit fc84581

Browse files
committed
Add unit tests for the new comparison strategy
1 parent 2586a3d commit fc84581

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/commitshaproviders/CommitShaProviderTest.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ class CommitShaProviderTest {
5858
assertThat(actual::class).isEqualTo(SpecifiedBranchCommitMergeBase::class)
5959
}
6060

61+
@Test
62+
fun givenSpecifiedRawCommitSha_whenFromString_thenReturnSpecifiedRawCommitSha() {
63+
val actual =
64+
CommitShaProvider.fromString("SpecifiedRawCommitSha", specifiedRawCommitSha = "sha")
65+
66+
assertThat(actual::class).isEqualTo(SpecifiedRawCommitSha::class)
67+
}
68+
69+
@Test
70+
fun givenSpecifiedRawCommitShaAndSpecifiedRawCommitShaNull_whenFromString_thenThrowException() {
71+
try {
72+
CommitShaProvider.fromString("SpecifiedRawCommitSha")
73+
} catch (e: Exception) {
74+
assertThat(e::class).isEqualTo(IllegalArgumentException::class)
75+
assertThat(e.message).isEqualTo("Specified raw commit sha must be defined")
76+
}
77+
}
78+
6179
@Test
6280
fun givenInvalidCommitString_whenFromString_thenExceptionThrown() {
6381
try {

0 commit comments

Comments
 (0)