Merge pull request #23 from lucasnlm/fix-bug-on-difficulty-converter

Fix bug on DifficultyConverter
This commit is contained in:
Lucas Nunes 2020-03-22 00:33:31 -03:00 committed by GitHub
commit dd05988e54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -12,6 +12,7 @@ class DifficultyConverter {
1 -> Difficulty.Beginner 1 -> Difficulty.Beginner
2 -> Difficulty.Intermediate 2 -> Difficulty.Intermediate
3 -> Difficulty.Expert 3 -> Difficulty.Expert
4 -> Difficulty.Custom
else -> throw IllegalArgumentException("Could not recognize Difficulty") else -> throw IllegalArgumentException("Could not recognize Difficulty")
} }

View file

@ -13,6 +13,7 @@ class DifficultyConverterTest {
assertEquals(converter.toDifficulty(1), Difficulty.Beginner) assertEquals(converter.toDifficulty(1), Difficulty.Beginner)
assertEquals(converter.toDifficulty(2), Difficulty.Intermediate) assertEquals(converter.toDifficulty(2), Difficulty.Intermediate)
assertEquals(converter.toDifficulty(3), Difficulty.Expert) assertEquals(converter.toDifficulty(3), Difficulty.Expert)
assertEquals(converter.toDifficulty(4), Difficulty.Custom)
} }
@Test(expected = IllegalArgumentException::class) @Test(expected = IllegalArgumentException::class)
@ -28,5 +29,6 @@ class DifficultyConverterTest {
assertEquals(converter.toInteger(Difficulty.Beginner), 1) assertEquals(converter.toInteger(Difficulty.Beginner), 1)
assertEquals(converter.toInteger(Difficulty.Intermediate), 2) assertEquals(converter.toInteger(Difficulty.Intermediate), 2)
assertEquals(converter.toInteger(Difficulty.Expert), 3) assertEquals(converter.toInteger(Difficulty.Expert), 3)
assertEquals(converter.toInteger(Difficulty.Custom), 4)
} }
} }