1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.job.internal; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.jmock.Expectations; |
26 |
|
import org.junit.Assert; |
27 |
|
import org.junit.Test; |
28 |
|
import org.xwiki.context.Execution; |
29 |
|
import org.xwiki.context.ExecutionContextManager; |
30 |
|
import org.xwiki.context.internal.DefaultExecution; |
31 |
|
import org.xwiki.context.internal.DefaultExecutionContextManager; |
32 |
|
import org.xwiki.job.JobManager; |
33 |
|
import org.xwiki.job.JobStatusStore; |
34 |
|
import org.xwiki.test.annotation.ComponentList; |
35 |
|
import org.xwiki.test.jmock.AbstractMockingComponentTestCase; |
36 |
|
import org.xwiki.test.jmock.annotation.MockingRequirement; |
37 |
|
|
38 |
|
|
39 |
|
@link |
40 |
|
|
41 |
|
@version |
42 |
|
|
43 |
|
@MockingRequirement(value = DefaultJobManager.class, exceptions = { ExecutionContextManager.class, Execution.class }) |
44 |
|
@ComponentList({ |
45 |
|
DefaultExecution.class, |
46 |
|
DefaultExecutionContextManager.class |
47 |
|
}) |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
48 |
|
public class DefaultJobManagerTest extends AbstractMockingComponentTestCase<JobManager> |
49 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void testGetJobStatusForUnexistingJob() throws Exception |
52 |
|
{ |
53 |
1 |
final List<String> jobId = Arrays.asList("unexisting-job"); |
54 |
1 |
final JobStatusStore jobStatusStorage = getComponentManager().getInstance(JobStatusStore.class); |
55 |
|
|
56 |
1 |
getMockery().checking(new Expectations() |
57 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
58 |
1 |
{... |
59 |
1 |
oneOf(jobStatusStorage).getJobStatus(jobId); |
60 |
1 |
will(returnValue(null)); |
61 |
|
} |
62 |
|
}); |
63 |
|
|
64 |
1 |
Assert.assertNull(getMockedComponent().getJobStatus(jobId)); |
65 |
|
} |
66 |
|
} |