BAEL-1815: RomanNumeral and RomanArabicConverter (#4565)

* BAEL-1815: RomanNumeral and RomanArabicConverter

* Refactored getReverseSortedValues
This commit is contained in:
Eric Martin
2018-06-28 22:59:08 -05:00
committed by Grzegorz Piwowarek
parent e065d94685
commit b1d194cdb5
3 changed files with 107 additions and 0 deletions
@@ -0,0 +1,29 @@
package com.baeldung.algorithms.romannumerals;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
public class RomanArabicConverterUnitTest {
@Test
public void given2018Roman_WhenConvertingToArabic_ThenReturn2018() {
String roman2018 = "MMXVIII";
int result = RomanArabicConverter.romanToArabic(roman2018);
assertThat(result).isEqualTo(2018);
}
@Test
public void given1999Arabic_WhenConvertingToRoman_ThenReturnMCMXCIX() {
int arabic1999 = 1999;
String result = RomanArabicConverter.arabicToRoman(arabic1999);
assertThat(result).isEqualTo("MCMXCIX");
}
}