文件名称:小芳便利店 java 源代码
文件大小:9KB
文件格式:RAR
更新时间:2015-06-10 10:44:47
便利店 源代码 java
小芳便利店 源代码 java写的 ackage account; import junit.framework.TestCase; public class AccountTest extends TestCase { private Account AccountA; private Account AccountB; public AccountTest(String name) { super(name); } public void setUp(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); } public static void main(String args[]) { junit.textui.TestRunner.run(AccountTest.class); } public void testAccount(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); //assertEquals("notyy",AccountA.Owner); //assertEquals(100,AccountA.Balance,2); //assertEquals("bricks",AccountB.Owner); //assertEquals(200,AccountB.Balance,2); assertEquals("notyy",AccountA.getOwner()); } public void testCredit(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); AccountA.credit(100); //100+100=200 assertEquals(200,AccountA.getBalance(),2); AccountB.credit(150); //200+150=350 assertEquals(350,AccountB.getBalance(),2); } public void testDiscount(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); AccountA.discount(50); //100-50=50 assertEquals(50.00,AccountA.getBalance(),2); AccountB.discount(120); //200-120=80 assertEquals(80,AccountB.getBalance(),2); } public void testTransfer(){ AccountA.transfer(AccountB,80.00); //100-80=20 //200+80=280 assertEquals(20.00,AccountA.getBalance(),2); assertEquals(280.00,AccountB.getBalance(),2); } }
【文件预览】:
Junit实验程序
----forJunit3.8_swing()
--------SampleCalculator.java(245B)
--------MyStack.java(615B)
--------TestSample.java(713B)
--------AccountTest.java(2KB)
--------Account.java(569B)
--------Account.java.bak(569B)
--------StackTest.java(499B)
--------junit()
--------TestMyAllSample.java(427B)
----forJunit4.1_text()
--------account()
--------AccountTest.java(1KB)
--------Account.java(534B)