You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
package com.ugsbo.Buchhaltung;
|
|
|
|
import static org.junit.Assert.*;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import ugsbo.com.buchhaltung.Blockchain;
|
|
|
|
public class Test_Blockchain {
|
|
|
|
public Blockchain Workingobjekt;
|
|
|
|
@Before
|
|
public void setUp() throws Exception {
|
|
Workingobjekt = new Blockchain();
|
|
}
|
|
|
|
@Test
|
|
public void hinzufügen() {
|
|
int eingabe = 500;
|
|
int ergebnis;
|
|
|
|
Workingobjekt.add(eingabe);
|
|
ergebnis = Workingobjekt.kontostand();
|
|
|
|
assertEquals("eingabe und Ergebnis sind gleich", eingabe, ergebnis);
|
|
}
|
|
|
|
@Test
|
|
public void hinzufügenNegativ() {
|
|
int eingabe = -500;
|
|
int ergebnis;
|
|
|
|
Workingobjekt.add(eingabe);
|
|
ergebnis = Workingobjekt.kontostand();
|
|
|
|
assertEquals("eingabe und Ergebnis sind gleich", eingabe, ergebnis);
|
|
}
|
|
|
|
@Test
|
|
public void hinzufügenIstNull() {
|
|
int eingabe = 0;
|
|
int ergebnis;
|
|
|
|
Workingobjekt.add(eingabe);
|
|
ergebnis = Workingobjekt.kontostand();
|
|
|
|
assertEquals("eingabe und Ergebnis sind gleich", eingabe, ergebnis);
|
|
}
|
|
|
|
@Test
|
|
public void hinzufügenMehrAlsEinmal() {
|
|
int eingabe = 100;
|
|
int erwartet = 300;
|
|
int ergebnis;
|
|
|
|
Workingobjekt.add(eingabe);
|
|
Workingobjekt.add(eingabe);
|
|
Workingobjekt.add(eingabe);
|
|
ergebnis = Workingobjekt.kontostand();
|
|
|
|
assertEquals("eingabe und Ergebnis sind gleich", erwartet, ergebnis);
|
|
}
|
|
}
|