EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.tcfmoop.tests]

COVERAGE SUMMARY FOR SOURCE FILE [ElapsedTimeCriterionTest.java]

nameclass, %method, %block, %line, %
ElapsedTimeCriterionTest.java0%   (0/1)0%   (0/4)0%   (0/136)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElapsedTimeCriterionTest0%   (0/1)0%   (0/4)0%   (0/136)0%   (0/30)
ElapsedTimeCriterionTest (): void 0%   (0/1)0%   (0/3)0%   (0/1)
setUp (): void 0%   (0/1)0%   (0/91)0%   (0/19)
testCPUTime (): void 0%   (0/1)0%   (0/21)0%   (0/5)
testUserTime (): void 0%   (0/1)0%   (0/21)0%   (0/5)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.tcfmoop.tests;
5 
6import static org.junit.Assert.*;
7 
8import org.junit.Before;
9import org.junit.Test;
10 
11import de.uka.ipd.sdq.tcfmoop.config.ElapsedTimeConfig;
12import de.uka.ipd.sdq.tcfmoop.config.ElapsedTimeConfig.TimeType;
13import de.uka.ipd.sdq.tcfmoop.terminationcriteria.ElapsedTimeCriterion;
14 
15/**
16 * @author Atanas Dimitrov
17 *
18 */
19public class ElapsedTimeCriterionTest {
20        ElapsedTimeConfig etconfUser;
21        ElapsedTimeCriterion etcritUser;
22        ElapsedTimeConfig etconfCPUFalse;
23        ElapsedTimeCriterion etcritCPUFalse;
24        ElapsedTimeConfig etconfCPUTrue;
25        ElapsedTimeCriterion etcritCPUTrue;
26        
27        /**
28         * @throws java.lang.Exception
29         */
30        @Before
31        public void setUp() throws Exception {
32                //User Time
33                etconfUser = new ElapsedTimeConfig();
34                etconfUser.setExecutionInterval(1000*60*60);
35                etconfUser.setTimeType(TimeType.USER_TIME);
36                if(!etconfUser.validateConfiguration()){
37                        throw new Exception();
38                }
39                etcritUser = new ElapsedTimeCriterion(etconfUser, null, null);
40                
41                //CPU False
42                etconfCPUFalse = new ElapsedTimeConfig();
43                etconfCPUFalse.setExecutionInterval(1000*60*60);
44                etconfCPUFalse.setTimeType(TimeType.CPU_TIME);
45                if(!etconfCPUFalse.validateConfiguration()){
46                        throw new Exception();
47                }
48                etcritCPUFalse = new ElapsedTimeCriterion(etconfCPUFalse, null, null);
49                
50                //CPU True
51                etconfCPUTrue = new ElapsedTimeConfig();
52                etconfCPUTrue.setExecutionInterval(10);
53                etconfCPUTrue.setTimeType(TimeType.CPU_TIME);
54                if(!etconfCPUTrue.validateConfiguration()){
55                        throw new Exception();
56                }
57                etcritCPUTrue = new ElapsedTimeCriterion(etconfCPUTrue, null, null);
58        }
59 
60        /**
61         * Test method for {@link de.uka.ipd.sdq.tcfmoop.terminationcriteria.AbstractTerminationCriterion#getEvaluationResult()}.
62         */
63        @Test
64        public void testUserTime() {
65                etcritUser.evaluate(251, System.currentTimeMillis());
66                assertFalse(etcritUser.getEvaluationResult());
67                etcritUser.evaluate(251, System.currentTimeMillis() + (1000*60*60*2));
68                assertTrue(etcritUser.getEvaluationResult());
69        }
70        
71        /**
72         * Test method for {@link de.uka.ipd.sdq.tcfmoop.terminationcriteria.AbstractTerminationCriterion#getEvaluationResult()}.
73         */
74        @Test
75        public void testCPUTime() {
76                etcritUser.evaluate(251, System.currentTimeMillis());
77                assertFalse(etcritUser.getEvaluationResult());
78                etcritUser.evaluate(251, System.currentTimeMillis() + (1000*60*60*2));
79                assertTrue(etcritUser.getEvaluationResult());
80        }
81 
82}

[all classes][de.uka.ipd.sdq.tcfmoop.tests]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov