Skip to content
Permalink
Browse files

Test for charging for a summing, calculator missing.

  • Loading branch information...
jacekbilski committed Feb 1, 2019
1 parent 7d032a2 commit 579a1018c0ee8ee2b21fbe64d8a4ce7dfb5b32e8
@@ -4,6 +4,7 @@

import java.math.BigDecimal;

import static java.math.BigDecimal.ONE;
import static java.math.BigDecimal.ZERO;
import static org.assertj.core.api.Assertions.assertThat;

@@ -16,4 +17,11 @@ void returnBalanceZero_whenNoCalculationsWereDone() {
BigDecimal balance = billing.getBalance();
assertThat(balance).isEqualByComparingTo(ZERO);
}

@Test
void returnBalanceOfOne_afterCalculatingOneSum() {
calculator.eval("1 2 +", 0);
BigDecimal balance = billing.getBalance();
assertThat(balance).isEqualByComparingTo(ONE);
}
}
@@ -21,7 +21,7 @@ public Calculator() {
((DecimalFormat) formatter).setParseBigDecimal(true);
}

String eval(String input, int maxFractionDigits) {
public String eval(String input, int maxFractionDigits) {
String[] tokens = input.split(" ");
var stack = new Stack<BigDecimal>();
for (String token : tokens) {

0 comments on commit 579a101

Please sign in to comment.
You can’t perform that action at this time.