-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPredicateTest.java
More file actions
56 lines (44 loc) · 2.09 KB
/
PredicateTest.java
File metadata and controls
56 lines (44 loc) · 2.09 KB
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
47
48
49
50
51
52
53
54
55
56
package com.checkmarx.ast;
import com.checkmarx.ast.predicate.Predicate;
import com.checkmarx.ast.results.Results;
import com.checkmarx.ast.results.result.Result;
import com.checkmarx.ast.scan.Scan;
import com.checkmarx.ast.wrapper.CxConstants;
import org.junit.Ignore;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
import java.util.UUID;
class PredicateTest extends BaseTest {
public static final String TO_VERIFY = "TO_VERIFY";
public static final String HIGH = "HIGH";
@Test
void testTriage() throws Exception {
Map<String, String> params = commonParams();
Scan scan = wrapper.scanCreate(params);
UUID scanId = UUID.fromString(scan.getId());
Assertions.assertEquals("Completed", wrapper.scanShow(scanId).getStatus());
Results results = wrapper.results(scanId);
Result result = results.getResults().stream().filter(res -> res.getType().equalsIgnoreCase(CxConstants.SAST)).findFirst().get();
List<Predicate> predicates = wrapper.triageShow(UUID.fromString(scan.getProjectId()), result.getSimilarityId(), result.getType());
Assertions.assertNotNull(predicates);
try {
wrapper.triageUpdate(UUID.fromString(scan.getProjectId()), result.getSimilarityId(), result.getType(), TO_VERIFY, "Edited via Java Wrapper", HIGH);
} catch (Exception e) {
Assertions.fail("Triage update failed. Should not throw exception");
}
try {
wrapper.triageUpdate(UUID.fromString(scan.getProjectId()), result.getSimilarityId(), result.getType(), result.getState(), "Edited back to normal", result.getSeverity());
} catch (Exception e) {
Assertions.fail("Triage update failed. Should not throw exception");
}
}
@Test
@Disabled("Ignore this tests until get states api will be in production")
void testGetStates() throws Exception {
List<Predicate> states = wrapper.triageGetStates(false);
Assertions.assertNotNull(states);
}
}