01: /*
02: * StatusLineComponentTest.java
03: * JUnit based test
04: *
05: * Created on March 20, 2007, 2:37 PM
06: */
07:
08: package org.netbeans.modules.progress.ui;
09:
10: import junit.framework.TestCase;
11:
12: /**
13: *
14: * @author mkleint
15: */
16: public class StatusLineComponentTest extends TestCase {
17:
18: public StatusLineComponentTest(String testName) {
19: super (testName);
20: }
21:
22: public void testGetBarString() {
23: long estimatedCompletion = -1;
24:
25: double percentage = 0.0;
26: String result = StatusLineComponent.getBarString(percentage,
27: estimatedCompletion);
28: assertEquals("0%", result);
29:
30: percentage = 0.49;
31: result = StatusLineComponent.getBarString(percentage,
32: estimatedCompletion);
33: assertEquals("0%", result);
34:
35: percentage = 1.0;
36: result = StatusLineComponent.getBarString(percentage,
37: estimatedCompletion);
38: assertEquals("1%", result);
39:
40: percentage = 50.0;
41: result = StatusLineComponent.getBarString(percentage,
42: estimatedCompletion);
43: assertEquals("50%", result);
44:
45: percentage = 99.33;
46: result = StatusLineComponent.getBarString(percentage,
47: estimatedCompletion);
48: assertEquals("99%", result);
49:
50: percentage = 99.51;
51: result = StatusLineComponent.getBarString(percentage,
52: estimatedCompletion);
53: assertEquals("100%", result);
54:
55: percentage = 100.1;
56: result = StatusLineComponent.getBarString(percentage,
57: estimatedCompletion);
58: assertEquals("100%", result);
59: }
60: }
|