01 package fr.isae.bank;
02
03 import org.junit.*;
04 import static org.junit.Assert.*;
05
06 /**
07 * Unit Test for class CompteSimple.
08 *
09 *
10 * Created: Wed Nov 30 22:42:37 2005
11 *
12 * @author <a href="mailto:garion@isae.fr">Christophe Garion</a>
13 * @version 1.0
14 */
15 public class CompteSimpleTest {
16
17 private CompteSimple c;
18
19 protected CompteSimple createCompte(Personne p, double solde) {
20 return new CompteSimple(p, solde);
21 }
22
23 @Before public void setUp() {
24 this.c = this.createCompte(new Personne("Christophe", "Garion", true),
25 1000);
26 }
27
28 @Test public void testGetSolde() {
29 Assert.assertEquals(1000, this.c.getSolde(), 0.0);
30 }
31
32 @Test public void testCrediter() {
33 this.c.crediter(100);
34 Assert.assertEquals(1100, this.c.getSolde(), 0.0);
35 }
36
37 @Test public void testDebiter() {
38 this.c.debiter(300);
39 Assert.assertEquals(700, this.c.getSolde(), 0.0);
40 }
41 }
|