1 package org
.argeo
.slc
.core
.test
.tree
;
5 import org
.argeo
.slc
.core
.process
.SlcExecution
;
6 import org
.argeo
.slc
.core
.process
.SlcExecutionStep
;
7 import org
.argeo
.slc
.core
.process
.SlcExecutionTestUtils
;
8 import org
.argeo
.slc
.core
.structure
.SimpleSElement
;
9 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
10 import org
.argeo
.slc
.core
.structure
.tree
.TreeSRegistry
;
11 import org
.argeo
.slc
.core
.test
.NumericTRId
;
12 import org
.argeo
.slc
.core
.test
.SimpleResultPart
;
13 import org
.argeo
.slc
.core
.test
.TestStatus
;
15 public abstract class TreeTestResultTestUtils
{
17 public static TreeTestResult
createSimpleTreeTestResult() {
18 TreeTestResult treeTestResult
= new TreeTestResult();
19 treeTestResult
.setNumericResultId(new NumericTRId(System
20 .currentTimeMillis()));
21 treeTestResult
.setCloseDate(new Date());
22 return treeTestResult
;
25 public static TreeTestResult
createCompleteTreeTestResult() {
26 SlcExecution slcExecution
= SlcExecutionTestUtils
27 .createSimpleSlcExecution();
28 SlcExecutionStep step
= new SlcExecutionStep("LOG", "JUnit step");
29 slcExecution
.getSteps().add(step
);
31 String pathStr
= "/test";
32 TreeSPath path
= TreeSPath
.parseToCreatePath(pathStr
);
34 TreeSRegistry registry
= new TreeSRegistry();
35 SimpleSElement elem
= new SimpleSElement("Unit Test");
36 elem
.getTags().put("myTag", "myTagValue");
37 registry
.register(path
, elem
);
39 TreeTestResult ttr
= createSimpleTreeTestResult();
40 ttr
.notifySlcExecution(slcExecution
);
41 ttr
.notifyCurrentPath(registry
, path
);
43 ttr
.addResultPart(createSimpleResultPartPassed());
44 ttr
.addResultPart(createSimpleResultPartFailed());
45 ttr
.addResultPart(createSimpleResultPartError());
49 public static SimpleResultPart
createSimpleResultPartPassed() {
50 SimpleResultPart partPassed
= new SimpleResultPart();
51 String msgPassed
= "message";
52 partPassed
.setStatus(TestStatus
.PASSED
);
53 partPassed
.setMessage(msgPassed
);
57 public static SimpleResultPart
createSimpleResultPartFailed() {
58 SimpleResultPart partFailed
= new SimpleResultPart();
59 String msgFailed
= "too bad";
60 partFailed
.setStatus(TestStatus
.FAILED
);
61 partFailed
.setMessage(msgFailed
);
65 public static SimpleResultPart
createSimpleResultPartError() {
66 SimpleResultPart partFailed
= new SimpleResultPart();
67 String msgFailed
= "crashed";
68 partFailed
.setStatus(TestStatus
.ERROR
);
69 partFailed
.setMessage(msgFailed
);
70 partFailed
.setException(new Exception("Test Exception"));
74 private TreeTestResultTestUtils() {