GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit 55eb82e3 authored by Christoph Thelen's avatar Christoph Thelen

Add example test cases

parent 5d933077
package net.mandaria.tippytipper.services;
import org.junit.Before;
import org.junit.Test;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import static junit.framework.Assert.assertEquals;
public class TipCalculatorServiceTest {
private TipCalculatorService t;
@Before
public void setUp() {
t = new TipCalculatorService();
t.AppendNumberToBillAmount("100");
}
@Test
public void shouldCalculateEmptyTip() {
t.SetTipPercentage(0);
t.CalculateTip();
assertEquals("0,00 €", t.GetTipAmount());
}
@Test
public void shouldCalculateEmptyTax() {
t.SetTipPercentage(0);
t.SetTaxPercentage(0);
t.CalculateTip();
assertEquals("0,00 €", t.GetTipAmount());
}
@Test
public void shouldCalculatePlainBillAmount() {
t.SetTipPercentage(0);
t.SetTaxPercentage(0);
t.CalculateTip();
assertEquals("1,00 €", t.GetBillAmount());
}
@Test
public void testShouldFail() {
TipCalculatorService t = new TipCalculatorService();
fail(":-(");
public void shouldCalculateTipAmount() {
t.SetTipPercentage(0.5);
t.SetTaxPercentage(0);
t.CalculateTip();
assertEquals("0,50 €", t.GetTipAmount());
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment