Funktionen Implementiert, Tests angepasst, Java Doc added
This commit is contained in:
@@ -19,7 +19,7 @@ public class CoinsTest {
|
||||
coin.addCoin(-10);
|
||||
fail("Erwartet NegativAmountException - addCoin");
|
||||
}catch (NegativAmountException negativAmountException) {
|
||||
assertTrue(negativAmountException.getMessage()=="negativAmountException");
|
||||
assertTrue(negativAmountException.getMessage().equals("Es kann kein negativer amount an Coins hinzugefügt werden"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CoinsTest {
|
||||
coin.removeCoin(-10);
|
||||
fail("Erwartet NegativAmountException - removeCoin");
|
||||
}catch (NegativAmountException negativAmountException) {
|
||||
assertTrue(negativAmountException.getMessage()=="negativAmountException");
|
||||
assertTrue(negativAmountException.getMessage().equals("Es kann kein negativer amount an Coins hinzugefügt werden"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,20 @@ public class CoinsTest {
|
||||
@Test
|
||||
public void test_changeCoinAmount_true(){
|
||||
Coins coin = new Coins(10);
|
||||
assertTrue(coin.changeCoinAmmount(-10));
|
||||
try {
|
||||
assertTrue(coin.changeCoinAmmount(10));
|
||||
} catch (NegativAmountException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_changeCoinAmount_false(){
|
||||
Coins coin = new Coins(9);
|
||||
assertFalse(coin.changeCoinAmmount(-10));
|
||||
try {
|
||||
assertTrue(coin.changeCoinAmmount(7));
|
||||
} catch (NegativAmountException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user