JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 技巧文件  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 GradeSystem test code
heyipomoea





發文: 40
積分: 0
於 2013-04-02 09:06 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import static org.junit.Assert.*;
 
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
 
public class testCalculateTotalGrade 
{
Grades aGrade = null;
@Before
public void setUp() throws Exception 
{
aGrade = new Grades();
aGrade.ID = "962001051";
aGrade.name = "李威廷";
aGrade.Lab1 = 81;
aGrade.Lab2 = 98;
aGrade.Lab3 = 84;
aGrade.midTerm = 90;
aGrade.finalExam = 93;
}
 
@After
public void tearDown() throws Exception 
{
aGrade = null;
}
 
@Test
public void testCalculateTotalGrade1() 
{
float[] weights = new float[]{(float) 0.1, (float) 0.1, (float) 0.1, (float) 0.3, (float) 0.4};
assertEquals(91,aGrade.calculateTotalGrade (weights));
}
public void testCalculateTotalGrade2() 
{
float[] weights = new float[]{(float) 0.2, (float) 0.2, (float) 0.2, (float) 0.2, (float) 0.2};
assertEquals(89,aGrade.calculateTotalGrade (weights));
}
public void testCalculateTotalGrade3() 
{
float[] weights = new float[]{(float) 0.1, (float) 0.1, (float) 0.0, (float) 0.4, (float) 0.4};
assertEquals(91,aGrade.calculateTotalGrade (weights));
}
 
}


寫了一段測試碼,
可以請各位大大幫我看一下還有哪邊需要修改嗎?
如果可以更提升此段code的品質

煩請大大指點! 謝謝


heyipomoea edited on 2013-04-02 13:12
reply to postreply to post
» JWorld@TW »  Java 技巧文件

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8