Merge pull request #23 from lucasnlm/fix-bug-on-difficulty-converter
Fix bug on DifficultyConverter
This commit is contained in:
commit
dd05988e54
2 changed files with 3 additions and 0 deletions
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue