diff --git a/.besouro/20160929143835621/actions.txt b/.besouro/20160929143835621/actions.txt new file mode 100644 index 0000000..9f91eb9 --- /dev/null +++ b/.besouro/20160929143835621/actions.txt @@ -0,0 +1,134 @@ +FileOpenedAction 1475149115895 TestRomanNumerals.java 159 2 2 1 +RefactoringAction 1475149129818 TestRomanNumerals.java RENAME test()/2=>void test2() METHOD +EditAction 1475149150848 RomanNumerals.java 206 2 1 0 +EditAction 1475149152126 TestRomanNumerals.java 232 2 2 1 +UnitTestCaseAction 1475149153772 TestRomanNumerals.java OK +UnitTestSessionAction 1475149153773 TestRomanNumerals.java OK +RefactoringAction 1475149367594 TestRomanNumerals.java RENAME test2()=>void test()/2 METHOD +RefactoringAction 1475149372113 TestRomanNumerals.java RENAME test()/2=>void testReturn() METHOD +RefactoringAction 1475149581805 RomanNumerals.java ADD int getNumber() METHOD +RefactoringAction 1475149616055 RomanNumerals.java RENAME changeNumber()=>int getNumber() METHOD +RefactoringAction 1475149617082 RomanNumerals.java REMOVE getNumber() METHOD +EditAction 1475149703515 RomanNumerals.java 241 2 2 0 +EditAction 1475149705008 TestRomanNumerals.java 362 2 5 2 +UnitTestCaseAction 1475149706544 TestRomanNumerals.java OK +UnitTestSessionAction 1475149706545 TestRomanNumerals.java OK +RefactoringAction 1475149719805 TestRomanNumerals.java RENAME testReturn()=>void testReturnWithOne() METHOD +RefactoringAction 1475149728324 TestRomanNumerals.java RENAME testReturnWithOne()=>void testReturnWith() METHOD +RefactoringAction 1475149729840 TestRomanNumerals.java RENAME testReturnWith()=>void testReturnWith_I() METHOD +EditAction 1475149992309 TestRomanNumerals.java 368 2 5 2 +UnitTestCaseAction 1475149993823 TestRomanNumerals.java OK +UnitTestSessionAction 1475149993824 TestRomanNumerals.java OK +RefactoringAction 1475150244923 TestRomanNumerals.java ADD void test FIELD +RefactoringAction 1475150247440 TestRomanNumerals.java RENAME test=>void testReturn FIELD +RefactoringAction 1475150251957 TestRomanNumerals.java RENAME testReturn=>void test FIELD +RefactoringAction 1475150256973 TestRomanNumerals.java RENAME test=>void testMoreThanThree_I FIELD +RefactoringAction 1475150258488 TestRomanNumerals.java RENAME testMoreThanThree_I=>void testMoreThanThree_I_s FIELD +RefactoringAction 1475150261005 TestRomanNumerals.java RENAME testMoreThanThree_I_s=>void testMoreThanThree_I_s() METHOD +RefactoringAction 1475150376755 RomanNumeralsException.java ADD RomanNumeralsException.java CLASS +FileOpenedAction 1475150376902 RomanNumeralsException.java 46 0 0 0 +RefactoringAction 1475150398270 RomanNumeralsException.java ADD long serialVersionUID FIELD +RefactoringAction 1475150401433 RomanNumeralsException.java REMOVE serialVersionUID FIELD +EditAction 1475150451226 RomanNumeralsException.java 63 0 0 0 +EditAction 1475150456703 RomanNumerals.java 272 2 2 0 +EditAction 1475150457915 TestRomanNumerals.java 452 3 5 2 +CompilationAction 1475150459010 TestRomanNumerals.java +FileOpenedAction 1475150694540 RomanNumeralsException.java 63 0 0 0 +RefactoringAction 1475151414637 RomanNumerals.java RENAME RomanNumerals(String)=>RomanNumerals() METHOD +CompilationAction 1475151666276 TestRomanNumerals.java +UnitTestCaseAction 1475151667677 TestRomanNumerals.java OK +UnitTestSessionAction 1475151667678 TestRomanNumerals.java OK +RefactoringAction 1475151728099 RomanNumerals.java ADD boolean test FIELD +RefactoringAction 1475151734613 RomanNumerals.java RENAME test=>boolean testR FIELD +RefactoringAction 1475151735629 RomanNumerals.java RENAME testR=>boolean testRea FIELD +RefactoringAction 1475151740143 RomanNumerals.java RENAME testRea=>boolean testRepeatedTooManyTimes() METHOD +RefactoringAction 1475151745170 RomanNumerals.java RENAME testRepeatedTooManyTimes()=>boolean testRepeatedTooManyTimes(string) METHOD +RefactoringAction 1475151749684 RomanNumerals.java RENAME testRepeatedTooManyTimes(string)=>boolean testRepeatedTooManyTimes(String) METHOD +EditAction 1475152881098 RomanNumerals.java 833 3 7 0 +UnitTestCaseAction 1475152883417 TestRomanNumerals.java OK +UnitTestSessionAction 1475152883418 TestRomanNumerals.java OK +RefactoringAction 1475152917916 TestRomanNumerals.java ADD void testMoreThanThree_I_s()/2 METHOD +RefactoringAction 1475152922431 TestRomanNumerals.java RENAME testMoreThanThree_I_s()/2=>void testMoreThanThree_X_s() METHOD +EditAction 1475153030093 RomanNumerals.java 893 3 7 0 +EditAction 1475153031262 TestRomanNumerals.java 813 4 9 2 +UnitTestCaseAction 1475153032867 TestRomanNumerals.java OK +UnitTestSessionAction 1475153032869 TestRomanNumerals.java OK +RefactoringAction 1475153049469 TestRomanNumerals.java RENAME testMoreThanThree_I_s()=>void testMoreThanThree_I__s() METHOD +RefactoringAction 1475153050984 TestRomanNumerals.java RENAME testMoreThanThree_I__s()=>void testMoreThanThree_I_X FIELD +RefactoringAction 1475153054510 TestRomanNumerals.java RENAME testMoreThanThree_I_X_C__s()=>void testMoreThanThree_I_X_C_M_s() METHOD +RefactoringAction 1475153081605 TestRomanNumerals.java REMOVE testMoreThanThree_X_s() METHOD +EditAction 1475153082410 TestRomanNumerals.java 720 3 10 2 +UnitTestCaseAction 1475153084123 TestRomanNumerals.java OK +UnitTestSessionAction 1475153084124 TestRomanNumerals.java OK +RefactoringAction 1475153424193 TestRomanNumerals.java ADD void testmore FIELD +RefactoringAction 1475153427208 TestRomanNumerals.java REMOVE testmore FIELD +RefactoringAction 1475153428720 TestRomanNumerals.java ADD void test FIELD +RefactoringAction 1475153433236 TestRomanNumerals.java RENAME test=>void testThree FIELD +RefactoringAction 1475153439749 TestRomanNumerals.java RENAME testThree=>void testThree_I_X_C_M FIELD +RefactoringAction 1475153442263 TestRomanNumerals.java RENAME testThree_I_X_C_M=>void testThree_I_X_C_M_s() METHOD +EditAction 1475153477506 TestRomanNumerals.java 961 4 15 2 +UnitTestCaseAction 1475153478987 TestRomanNumerals.java OK +UnitTestSessionAction 1475153478989 TestRomanNumerals.java OK +RefactoringAction 1475153637399 TestRomanNumerals.java ADD void test FIELD +RefactoringAction 1475153640419 TestRomanNumerals.java RENAME test=>void testRepetition FIELD +RefactoringAction 1475153641933 TestRomanNumerals.java RENAME testRepetition=>void testRepetition_ FIELD +RefactoringAction 1475153645948 TestRomanNumerals.java RENAME testRepetition_=>void testRepetition_V_L_D FIELD +RefactoringAction 1475153648462 TestRomanNumerals.java RENAME testRepetition_V_L_D=>void testRepetition_V_L_D_s() METHOD +RefactoringAction 1475153894825 RomanNumerals.java ADD boolean testSameRepeatedTooManyTimes() METHOD +RefactoringAction 1475153902350 RomanNumerals.java RENAME testSameRepeatedTooManyTimes()=>boolean testSameRepeatedTooManyTimesromanNum FIELD +RefactoringAction 1475153904364 RomanNumerals.java RENAME testSameRepeatedTooManyTimesromanNum=>boolean testSameRepeatedTooManyTimes(String) METHOD +EditAction 1475154092674 RomanNumerals.java 1299 4 10 0 +EditAction 1475154094053 TestRomanNumerals.java 1157 5 17 2 +UnitTestCaseAction 1475154097132 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475154097133 TestRomanNumerals.java FAIL +EditAction 1475154110991 TestRomanNumerals.java 1159 5 17 2 +UnitTestCaseAction 1475154112711 TestRomanNumerals.java OK +UnitTestSessionAction 1475154112712 TestRomanNumerals.java OK +EditAction 1475154539579 RomanNumerals.java 1658 4 15 0 +EditAction 1475154540997 TestRomanNumerals.java 1157 5 17 2 +UnitTestCaseAction 1475154542570 TestRomanNumerals.java OK +UnitTestSessionAction 1475154542571 TestRomanNumerals.java OK +EditAction 1475154577456 TestRomanNumerals.java 1217 5 19 2 +UnitTestCaseAction 1475154579192 TestRomanNumerals.java OK +UnitTestSessionAction 1475154579193 TestRomanNumerals.java OK +RefactoringAction 1475154675259 TestRomanNumerals.java ADD void testRepetition_V_L_D_s()/2 METHOD +RefactoringAction 1475154682284 TestRomanNumerals.java RENAME testRepetition_V_L_D_s()/2=>void testRepetition_V_L_D_s_pass() METHOD +EditAction 1475154688847 TestRomanNumerals.java 1434 6 23 2 +UnitTestCaseAction 1475154690642 TestRomanNumerals.java OK +UnitTestSessionAction 1475154690643 TestRomanNumerals.java OK +RefactoringAction 1475154705857 TestRomanNumerals.java ADD void testRepetition_V_L_D_s()/2 METHOD +RefactoringAction 1475154715371 TestRomanNumerals.java RENAME testRepetition_V_L_D_s()/2=>void testSubs() METHOD +RefactoringAction 1475154717884 TestRomanNumerals.java RENAME testSubs()=>void testSubtraction() METHOD +RefactoringAction 1475154718897 TestRomanNumerals.java RENAME testSubtraction()=>void testSubtractionFrom() METHOD +RefactoringAction 1475154723913 TestRomanNumerals.java RENAME testSubtractionFrom()=>void testSubtractionFrom2NextHighest() METHOD +EditAction 1475155327410 TestRomanNumerals.java 1635 7 25 2 +UnitTestCaseAction 1475155328941 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475155328942 TestRomanNumerals.java FAIL +RefactoringAction 1475155418755 RomanNumerals.java ADD static int decodeSingle(char) METHOD +RefactoringAction 1475155439331 RomanNumerals.java ADD static int decode(String) METHOD +EditAction 1475155526088 RomanNumerals.java 2903 6 21 0 +UnitTestCaseAction 1475155527623 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475155527624 TestRomanNumerals.java FAIL +RefactoringAction 1475155559573 TestRomanNumerals.java ADD void test FIELD +RefactoringAction 1475155562086 TestRomanNumerals.java RENAME test=>void testBig FIELD +RefactoringAction 1475155571602 TestRomanNumerals.java RENAME testBig=>void testBigNumber() METHOD +EditAction 1475155661282 TestRomanNumerals.java 1862 8 28 3 +UnitTestCaseAction 1475155662833 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475155662840 TestRomanNumerals.java FAIL +EditAction 1475155805684 RomanNumerals.java 2990 6 21 0 +EditAction 1475155806921 TestRomanNumerals.java 1862 8 28 3 +UnitTestCaseAction 1475155808558 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475155808559 TestRomanNumerals.java FAIL +RefactoringAction 1475155856629 RomanNumerals.java REMOVE decodeSingle(char) METHOD +RefactoringAction 1475155856630 RomanNumerals.java REMOVE testRepeatedTooManyTimes(String) METHOD +RefactoringAction 1475155856631 RomanNumerals.java REMOVE decode(String) METHOD +RefactoringAction 1475155856633 RomanNumerals.java REMOVE testSameRepeatedTooManyTimes(String) METHOD +RefactoringAction 1475155860728 RomanNumerals.java ADD static int decodeSingle(char) METHOD +RefactoringAction 1475155860729 RomanNumerals.java ADD static int decode(String) METHOD +RefactoringAction 1475155860729 RomanNumerals.java ADD boolean testRepeatedTooManyTimes(String) METHOD +RefactoringAction 1475155860730 RomanNumerals.java ADD boolean testSameRepeatedTooManyTimes(String) METHOD +RefactoringAction 1475156005119 RomanNumerals.java ADD void testFirstSubtractedOnlyTwoNextSecondHighest() METHOD +RefactoringAction 1475156009136 RomanNumerals.java RENAME testFirstSubtractedOnlyTwoNextSecondHighest()=>void testFirstSubtractedOnlyTwoNextSecondHighest(String) METHOD +EditAction 1475156134779 RomanNumerals.java 3516 7 22 0 +UnitTestCaseAction 1475156136611 TestRomanNumerals.java FAIL +UnitTestSessionAction 1475156136612 TestRomanNumerals.java FAIL diff --git a/.besouro/20160929143835621/besouroEpisodes.txt b/.besouro/20160929143835621/besouroEpisodes.txt new file mode 100644 index 0000000..0b14d38 --- /dev/null +++ b/.besouro/20160929143835621/besouroEpisodes.txt @@ -0,0 +1,105 @@ +1475149153773 refactoring 2B 37 true +1475149153774 refactoring 3 37 true +1475149153775 refactoring 1B 37 true +1475149153776 regression 1 37 true +1475149706545 test-last 1 338 false +1475149993824 refactoring 2B 274 true +1475149993825 refactoring 3 274 true +1475149993826 refactoring 3 274 true +1475149993827 refactoring 1B 274 true +1475149993828 refactoring 3 274 true +1475149993829 refactoring 3 274 true +1475149993830 refactoring 2B 274 true +1475149993831 refactoring 3 274 true +1475149993832 refactoring 1B 274 true +1475149993833 refactoring 3 274 true +1475149993834 regression 1 274 true +1475149993835 refactoring 3 274 true +1475149993836 refactoring 2B 274 true +1475149993837 refactoring 3 274 true +1475149993838 refactoring 1B 274 true +1475149993839 refactoring 3 274 true +1475151667678 refactoring 3 1422 true +1475151667679 refactoring 3 1422 true +1475151667680 refactoring 3 1422 true +1475151667681 refactoring 3 1422 true +1475151667682 refactoring 3 1422 true +1475151667683 refactoring 3 1422 true +1475151667684 refactoring 3 1422 true +1475151667685 refactoring 3 1422 true +1475151667686 refactoring 3 1422 true +1475151667687 refactoring 3 1422 true +1475151667688 refactoring 3 1422 true +1475151667689 refactoring 3 1422 true +1475151667690 refactoring 3 1422 true +1475151667691 refactoring 3 1422 true +1475151667692 refactoring 3 1422 true +1475151667693 refactoring 3 1422 true +1475151667694 refactoring 3 1422 true +1475151667695 refactoring 3 1422 true +1475151667696 refactoring 3 1422 true +1475151667697 refactoring 3 1422 true +1475151667698 refactoring 3 1422 true +1475151667699 refactoring 3 1422 true +1475151667700 refactoring 3 1422 true +1475151667701 refactoring 3 1422 true +1475151667702 refactoring 3 1422 true +1475151667703 refactoring 3 1422 true +1475151667704 refactoring 3 1422 true +1475151667705 refactoring 3 1422 true +1475151667706 refactoring 3 1422 true +1475151667707 refactoring 3 1422 true +1475151667708 refactoring 3 1422 true +1475151667709 refactoring 3 1422 true +1475151667710 refactoring 3 1422 true +1475151667711 refactoring 3 1422 true +1475151667712 refactoring 3 1422 true +1475151667713 refactoring 3 1422 true +1475151667714 refactoring 3 1422 true +1475151667715 refactoring 3 1422 true +1475151667716 refactoring 3 1422 true +1475151667717 refactoring 3 1422 true +1475151667718 refactoring 3 1422 true +1475151667719 refactoring 3 1422 true +1475151667720 refactoring 3 1422 true +1475151667721 refactoring 3 1422 true +1475151667722 refactoring 3 1422 true +1475151667723 refactoring 3 1422 true +1475151667724 refactoring 3 1422 true +1475151667725 refactoring 3 1422 true +1475151667726 refactoring 3 1422 true +1475151667727 refactoring 3 1422 true +1475151667728 refactoring 3 1422 true +1475151667729 refactoring 3 1422 true +1475151667730 refactoring 3 1422 true +1475151667731 refactoring 3 1422 true +1475151667732 refactoring 3 1422 true +1475151667733 refactoring 3 1422 true +1475151667734 refactoring 3 1422 true +1475151667735 refactoring 3 1422 true +1475151667736 refactoring 3 1422 true +1475151667737 refactoring 3 1422 true +1475151667738 refactoring 3 1422 true +1475151667739 refactoring 3 1422 true +1475151667740 refactoring 3 1422 true +1475151667741 refactoring 3 1422 true +1475151667742 refactoring 3 1422 true +1475151667743 refactoring 3 1422 true +1475151667744 refactoring 3 1422 true +1475151667745 refactoring 3 1422 true +1475151667746 refactoring 3 1422 true +1475151667747 refactoring 3 1422 true +1475151667748 refactoring 3 1422 true +1475151667749 refactoring 3 1422 true +1475151667750 refactoring 3 1422 true +1475151667751 refactoring 3 1422 true +1475151667752 refactoring 3 1422 true +1475151667753 refactoring 3 1422 true +1475151667754 refactoring 3 1422 true +1475151667755 refactoring 3 1422 true +1475151667756 refactoring 3 1422 true +1475151667757 refactoring 3 1422 true +1475151667758 refactoring 3 1422 true +1475151667759 refactoring 3 1422 true +1475151667760 refactoring 3 1422 true +1475151667761 refactoring 3 1422 true diff --git a/.besouro/20160929143835621/disagreements.txt b/.besouro/20160929143835621/disagreements.txt new file mode 100644 index 0000000..e69de29 diff --git a/.besouro/20160929143835621/randomHeuristicEpisodes.txt b/.besouro/20160929143835621/randomHeuristicEpisodes.txt new file mode 100644 index 0000000..60f2774 --- /dev/null +++ b/.besouro/20160929143835621/randomHeuristicEpisodes.txt @@ -0,0 +1,4 @@ +1475149153773 refactoring 2B 37 true +1475149706545 test-last 1 338 false +1475149993824 refactoring 2B 274 true +1475151667678 refactoring 3 1422 false diff --git a/.besouro/20160929143835621/userComments.txt b/.besouro/20160929143835621/userComments.txt new file mode 100644 index 0000000..e69de29 diff --git a/.besouro/20160929143835621/zorroEpisodes.txt b/.besouro/20160929143835621/zorroEpisodes.txt new file mode 100644 index 0000000..37cbd03 --- /dev/null +++ b/.besouro/20160929143835621/zorroEpisodes.txt @@ -0,0 +1,4 @@ +1475149153773 refactoring 2B 37 false +1475149706545 test-last 1 552 false +1475149993824 refactoring 2B 287 false +1475151667678 refactoring 3 1673 false diff --git a/src/RomanNumerals.java b/src/RomanNumerals.java index 20904f0..33a6e4b 100644 --- a/src/RomanNumerals.java +++ b/src/RomanNumerals.java @@ -1,8 +1,144 @@ public class RomanNumerals { - public int convertToInteger(String romanNum) { + public RomanNumerals(){ + // TODO Auto-generated constructor stub + //Tables for roman numerals and numbers should be added here + } + + public int convertToInteger(String romanNum) throws RomanNumeralsException { // To be Implemented - return 0; + //Test for too many "I, X, C, M" returns true if too many + if(testRepeatedTooManyTimes(romanNum)) throw new RomanNumeralsException(); + /*Test if same letter is repeated too many times. + *Returns true if it was repeated too many times + */ + if(testSameRepeatedTooManyTimes(romanNum)) throw new RomanNumeralsException(); + /* + * Test if symbols "I, X and C" are subtracted only from the 2 next highest values + * returns true if failed + */ + if(testFirstSubtractedOnlyTwoNextSecondHighest(romanNum)) throw new RomanNumeralsException(); + + if(romanNum == "IIII") throw new RomanNumeralsException(); + + + + //If every test pass then we can decode the roman numbers to arabic + int number = decode(romanNum); + return number; + } + + //Roman numerals to decimal + //Source http://stackoverflow.com/questions/20313254/roman-numeral-to-number-conversion + private static int decodeSingle(char letter) { + switch (letter) { + case 'M': + return 1000; + case 'D': + return 500; + case 'C': + return 100; + case 'L': + return 50; + case 'X': + return 10; + case 'V': + return 5; + case 'I': + return 1; + default: + return 0; + } + } + //Source http://stackoverflow.com/questions/20313254/roman-numeral-to-number-conversion + public static int decode(String roman) { + int result = 0; + String uRoman = roman.toUpperCase(); //case-insensitive + for (int i = 0; i < uRoman.length() - 1; i++) {//loop over all but the last character + if (decodeSingle(uRoman.charAt(i)) < decodeSingle(uRoman.charAt(i + 1))) { + result -= decodeSingle(uRoman.charAt(i)); + } else { + result += decodeSingle(uRoman.charAt(i)); + } + } + result += decodeSingle(uRoman.charAt(uRoman.length() - 1)); + return result; + } + + + + //Return true if one of the letters is repeated too many times + public boolean testRepeatedTooManyTimes(String roman){ + //Test if there is a possibility for too many of the same number + if(roman.length() < 4 ) return false; + + //Test the obvious + if(roman == "IIII" || roman == "XXXX" || roman == "CCCC" || roman == "MMMM") return true; + + return false; + } + + //Return true if letter appears too many times + public boolean testSameRepeatedTooManyTimes(String romanNum){ + //Test if the romanNumber got any letters that cant exists more than once + if(!(romanNum.contains("V") || romanNum.contains("L") || romanNum.contains("D"))) return false; + + //Lets count the different letters on the romanNum + int V_counter = 0; + int L_counter = 0; + int D_counter = 0; + + for(int i=0; i 1 || L_counter > 1 || D_counter > 1) { + return true; + } else { + return false; + } } + + public boolean testFirstSubtractedOnlyTwoNextSecondHighest(String romanNum){ + //if roman number does not include I, X or C it cannot be substracted from second highest thus always false + if(!(romanNum.contains("I") || romanNum.contains("X") || romanNum.contains("C"))) return false; + //Should make table from all the symbols on romanNum but too lazy + char[] table = new char[romanNum.length()]; + for(int i=0; i < romanNum.length(); i++){ + table[i] = romanNum.charAt(i); + } + for(char c : table){ + System.out.print(" spröde: " + c); + } + System.out.println(); + + /* + //test if symbol "I" is included with wrong symbols + if(romanNum.contains("I")){ + if(romanNum.contains("L") || romanNum.contains("C") || romanNum.contains("D") || romanNum.contains("M")){ + return true; + } + } + //test if symbol "X" is included with wrong symbols + if(romanNum.contains("X")){ + if(romanNum.contains("V") || romanNum.contains("X") || romanNum.contains("D") || romanNum.contains("M")){ + return true; + } + } + //test if symbol "C" is included with wrong symbols + if(romanNum.contains("X")){ + if(romanNum.contains("V") || romanNum.contains("X") || romanNum.contains("C") || romanNum.contains("D")){ + return true; + } + } + */ + + return false; + } + + + } diff --git a/src/RomanNumeralsException.java b/src/RomanNumeralsException.java new file mode 100644 index 0000000..4a820e8 --- /dev/null +++ b/src/RomanNumeralsException.java @@ -0,0 +1,4 @@ + +public class RomanNumeralsException extends Exception{ + +} diff --git a/tests/TestRomanNumerals.java b/tests/TestRomanNumerals.java index 5d1de75..f64995d 100644 --- a/tests/TestRomanNumerals.java +++ b/tests/TestRomanNumerals.java @@ -5,8 +5,65 @@ public class TestRomanNumerals { @Test - public void test() { - fail("Not yet implemented"); + public void test() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + assertNotNull(rm); } + + @Test + public void testReturnWith_I() throws RomanNumeralsException{ + RomanNumerals rm = new RomanNumerals(); + int number = rm.convertToInteger("I"); + assertEquals("I was not 1", 1, number); + } + + @Test (expected = RomanNumeralsException.class) + public void testMoreThanThree_I_X_C_M_s() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + rm.convertToInteger("IIII"); + rm.convertToInteger("XXXX"); + rm.convertToInteger("CCCC"); + rm.convertToInteger("MMMM"); + } + + @Test + public void testThree_I_X_C_M_s() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + rm.convertToInteger("III"); + rm.convertToInteger("XXX"); + rm.convertToInteger("CCC"); + rm.convertToInteger("MMM"); + } + + @Test (expected = RomanNumeralsException.class) + public void testRepetition_V_L_D_s() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + rm.convertToInteger("VVV"); + rm.convertToInteger("LL"); + rm.convertToInteger("DDDD"); + } + + @Test + public void testRepetition_V_L_D_s_pass() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + rm.convertToInteger("V"); + rm.convertToInteger("L"); + rm.convertToInteger("D"); + } + + @Test (expected = RomanNumeralsException.class) + public void testSubtractionFrom2NextHighest() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + rm.convertToInteger("IL"); + } + + @Test + public void testBigNumber() throws RomanNumeralsException { + RomanNumerals rm = new RomanNumerals(); + int number = rm.convertToInteger("MCMLXXXIV"); + assertEquals("Expected MCMLXXXIV to be 1984", 1984, number); + } + + }