@@ -87,6 +87,39 @@ public void SubtractTwoMonies() {
8787
8888 }
8989
90+ @ Test @ Tag ("Small" ) @ DisplayName ("Money with amount of 13.00 USD should be less than Money with amount 15.00 USD" )
91+ public void CompareAmountLessThan () {
92+
93+ var thirteen = Money .Of (13.00 , "USD" );
94+ var fifteen = Money .Of (15.00 , "USD" );
95+ var isLessThan = thirteen .LessThan (fifteen );
96+
97+ assertTrue (isLessThan );
98+
99+ }
100+
101+ @ Test @ Tag ("Small" ) @ DisplayName ("Money with amount of 15.00 USD should be greater than Money with amount 13.00 USD" )
102+ public void CompareAmountGreaterThan () {
103+
104+ var thirteen = Money .Of (13.00 , "USD" );
105+ var fifteen = Money .Of (15.00 , "USD" );
106+ var isGreaterThan = fifteen .GreaterThan (thirteen );
107+
108+ assertTrue (isGreaterThan );
109+
110+ }
111+
112+ @ Test @ Tag ("Small" ) @ DisplayName ("Money with amount of 13.00 USD should equal money with amount 13.00 USD" )
113+ public void CompareAmountEquals () {
114+
115+ var fifteenInstanceOne = Money .Of (15.00 , "USD" );
116+ var fifteenInstanceTwo = Money .Of (15.00 , "USD" );
117+ var isGreaterThan = fifteenInstanceOne .Equals (fifteenInstanceTwo );
118+
119+ assertTrue (isGreaterThan );
120+
121+ }
122+
90123 @ Test @ Tag ("Small" ) @ DisplayName ("Should get a Money with amount of -5 when you subtract a money instance of 10 " +
91124 "and a second instance o 15" )
92125 public void ShouldGetNegativeMoney () {
@@ -99,7 +132,7 @@ public void ShouldGetNegativeMoney() {
99132
100133 }
101134
102- @ Test @ Tag ("Small" ) @ DisplayName ("Should throw an ArithmeticExceptionn " +
135+ @ Test @ Tag ("Small" ) @ DisplayName ("Should throw an ArithmeticException " +
103136 "with message 'Cannot subtract monies of two different currencies'" )
104137 public void SubtractShouldThrowArithmeticExceptionForNotSameCurrency () {
105138
@@ -125,6 +158,45 @@ public void AddShouldThrowArithmeticExceptionForNotSameCurrency() {
125158
126159 }
127160
161+ @ Test @ Tag ("Small" ) @ DisplayName ("Should throw an ArithmeticException " +
162+ "with message 'Cannot compare of two different currencies.' " +
163+ "when comparing amount-less-than for two different currencies." )
164+ public void AmountLessThanThrowArithmeticExceptionForNotSameCurrency () {
165+
166+ var thirteen = Money .Of (13.00 , "USD" );
167+ var fifteen = Money .Of (15.00 , "GBP" );
168+
169+ var exception = assertThrows (ArithmeticException .class , () -> thirteen .LessThan (fifteen ));
170+ Assertions .assertEquals ("Cannot compare of two different currencies." , exception .getMessage ());
171+
172+ }
173+
174+ @ Test @ Tag ("Small" ) @ DisplayName ("Should throw an ArithmeticException " +
175+ "with message 'Cannot compare of two different currencies.' " +
176+ "when comparing amount-greater-than for two different currencies." )
177+ public void AmountGreaterThanArithmeticExceptionForNotSameCurrency () {
178+
179+ var thirteen = Money .Of (13.00 , "USD" );
180+ var fifteen = Money .Of (15.00 , "GBP" );
181+
182+ var exception = assertThrows (ArithmeticException .class , () -> fifteen .GreaterThan (thirteen ));
183+ Assertions .assertEquals ("Cannot compare of two different currencies." , exception .getMessage ());
184+
185+ }
186+
187+ @ Test @ Tag ("Small" ) @ DisplayName ("Should throw an ArithmeticException " +
188+ "with message 'Cannot compare of two different currencies.' " +
189+ "when comparing amount-equals for two different currencies." )
190+ public void AmountEqualsArithmeticExceptionForNotSameCurrency () {
191+
192+ var fifteenInstanceOne = Money .Of (15.00 , "USD" );
193+ var fifteenInstanceTwo = Money .Of (15.00 , "GBP" );
194+
195+ var exception = assertThrows (ArithmeticException .class , () -> fifteenInstanceOne .Equals (fifteenInstanceTwo ));
196+ Assertions .assertEquals ("Cannot compare of two different currencies." , exception .getMessage ());
197+
198+ }
199+
128200 @ Test @ Tag ("Small" ) @ DisplayName ("A money instance of $1 should equal the second instance of $1" )
129201 public void ShouldEqual () {
130202
0 commit comments