Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
fb46473
Test covergae to 55%
cx-atish-jadhav Jun 8, 2026
be3b592
coverage/cycle-6: add unit tests for ToolBarActions groupBy, ActionCa…
cx-aniket-shinde Jun 10, 2026
1d2d41b
Fix ActionOpenPreferencesPageTest hang: run MockedStatic tests on tes…
cx-aniket-shinde Jun 10, 2026
7a66a4e
coverage/cycle-6: Remove UI-mixed test files, add HoverListenerTest a…
cx-aniket-shinde Jun 10, 2026
ecc9518
fix: Configure JaCoCo report execution to point to production classes
cx-aniket-shinde Jun 10, 2026
e6e5454
test: Make HoverListenerTest and GlobalSettingsTest public, add unit.…
cx-aniket-shinde Jun 10, 2026
9abeb83
coverage/cycle-6: Add NotificationPopUpUITest (9 tests), fix test cla…
cx-aniket-shinde Jun 10, 2026
579a417
coverage/cycle-6: Restore working JaCoCo configuration from main branch
cx-aniket-shinde Jun 10, 2026
e44d98b
coverage/cycle-6: Update JaCoCo configuration from other/release-inte…
cx-aniket-shinde Jun 10, 2026
896b68d
Fix test execution: disable useUIHarness and add proper surefire phas…
cx-aniket-shinde Jun 19, 2026
d422408
Configure complete JaCoCo coverage reporting pipeline
cx-aniket-shinde Jun 19, 2026
b67df7e
Add Maven profiles for selective test execution
cx-aniket-shinde Jun 19, 2026
30dbff4
Revert "Add Maven profiles for selective test execution"
cx-aniket-shinde Jun 19, 2026
e03f0bb
Revert "Configure complete JaCoCo coverage reporting pipeline"
cx-aniket-shinde Jun 19, 2026
1830fc0
Revert "Fix test execution: disable useUIHarness and add proper suref…
cx-aniket-shinde Jun 19, 2026
108842f
removed ui test from unit part
cx-aniket-shinde Jun 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions checkmarx-ast-eclipse-plugin-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,34 @@
<formats>
<format>XML</format>
<format>CSV</format>
<format>HTML</format>
</formats>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<classesDirectory>${project.basedir}/../checkmarx-ast-eclipse-plugin/target/classes</classesDirectory>
<excludes>
<exclude>org/eclipse/wb/swt/SWTResourceManager.class</exclude>
</excludes>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.30</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package checkmarx.ast.eclipse.plugin.tests.unit.enums;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.Severity;

class SeverityTest {

@Test
void testGetSeverity_critical() {
assertEquals(Severity.CRITICAL, Severity.getSeverity("CRITICAL"));
}

@Test
void testGetSeverity_high() {
assertEquals(Severity.HIGH, Severity.getSeverity("HIGH"));
}

@Test
void testGetSeverity_medium() {
assertEquals(Severity.MEDIUM, Severity.getSeverity("MEDIUM"));
}

@Test
void testGetSeverity_low() {
assertEquals(Severity.LOW, Severity.getSeverity("LOW"));
}

@Test
void testGetSeverity_info() {
assertEquals(Severity.INFO, Severity.getSeverity("INFO"));
}

@Test
void testGetSeverity_groupBySeverity() {
assertEquals(Severity.GROUP_BY_SEVERITY, Severity.getSeverity("GROUP_BY_SEVERITY"));
}

@Test
void testGetSeverity_groupByQueryName() {
assertEquals(Severity.GROUP_BY_QUERY_NAME, Severity.getSeverity("GROUP_BY_QUERY_NAME"));
}

@Test
void testGetSeverity_groupByStateName() {
assertEquals(Severity.GROUP_BY_STATE_NAME, Severity.getSeverity("GROUP_BY_STATE_NAME"));
}

@Test
void testGetSeverity_unknownValue_throwsIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> Severity.getSeverity("UNKNOWN_SEVERITY_XYZ"));
}

@Test
void testGetSeverity_roundTrip_allValues() {
for (Severity severity : Severity.values()) {
assertEquals(severity, Severity.getSeverity(severity.name()));
}
}

@Test
void testEnumValues_count() {
assertEquals(8, Severity.values().length);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package checkmarx.ast.eclipse.plugin.tests.unit.enums;

import static org.junit.jupiter.api.Assertions.*;

import java.util.Map;

import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.State;

class StateTest {

// ─── predefined constants ────────────────────────────────────────────────

@Test
void testPredefinedConstants_notNull() {
assertNotNull(State.TO_VERIFY);
assertNotNull(State.NOT_EXPLOITABLE);
assertNotNull(State.PROPOSED_NOT_EXPLOITABLE);
assertNotNull(State.CONFIRMED);
assertNotNull(State.NOT_IGNORED);
assertNotNull(State.IGNORED);
assertNotNull(State.URGENT);
}

@Test
void testPredefinedConstants_names() {
assertEquals("TO_VERIFY", State.TO_VERIFY.getName());
assertEquals("NOT_EXPLOITABLE", State.NOT_EXPLOITABLE.getName());
assertEquals("PROPOSED_NOT_EXPLOITABLE", State.PROPOSED_NOT_EXPLOITABLE.getName());
assertEquals("CONFIRMED", State.CONFIRMED.getName());
assertEquals("NOT_IGNORED", State.NOT_IGNORED.getName());
assertEquals("IGNORED", State.IGNORED.getName());
assertEquals("URGENT", State.URGENT.getName());
}

// ─── toString ────────────────────────────────────────────────────────────

@Test
void testToString_returnsName() {
assertEquals("TO_VERIFY", State.TO_VERIFY.toString());
assertEquals("CONFIRMED", State.CONFIRMED.toString());
assertEquals("IGNORED", State.IGNORED.toString());
assertEquals("URGENT", State.URGENT.toString());
}

// ─── getState ────────────────────────────────────────────────────────────

@Test
void testGetState_existingPredefined_returnsInstance() {
assertNotNull(State.getState("TO_VERIFY"));
assertEquals("TO_VERIFY", State.getState("TO_VERIFY").getName());
}

@Test
void testGetState_allPredefinedStates_found() {
assertNotNull(State.getState("NOT_EXPLOITABLE"));
assertNotNull(State.getState("PROPOSED_NOT_EXPLOITABLE"));
assertNotNull(State.getState("CONFIRMED"));
assertNotNull(State.getState("NOT_IGNORED"));
assertNotNull(State.getState("IGNORED"));
assertNotNull(State.getState("URGENT"));
}

@Test
void testGetState_nonExistent_returnsNull() {
assertNull(State.getState("DOES_NOT_EXIST_STATE_XYZ_123"));
}

// ─── of ──────────────────────────────────────────────────────────────────

@Test
void testOf_existingPredefined_returnsSameInstance() {
assertSame(State.TO_VERIFY, State.of("TO_VERIFY"));
}

@Test
void testOf_newName_createsAndRegisters() {
String name = "CUSTOM_OF_TEST_UNIQUE_E5";
State result = State.of(name);
assertNotNull(result);
assertEquals(name, result.getName());
assertSame(result, State.getState(name));
}

@Test
void testOf_sameName_returnsSameInstance() {
String name = "CUSTOM_OF_SAME_UNIQUE_F6";
State first = State.of(name);
State second = State.of(name);
assertSame(first, second);
}

@Test
void testOf_customState_toString() {
String name = "MY_CUSTOM_STATE_G7";
State state = State.of(name);
assertEquals(name, state.toString());
}

// ─── values ──────────────────────────────────────────────────────────────

@Test
void testValues_isUnmodifiable() {
Map<String, State> vals = State.values();
assertThrows(UnsupportedOperationException.class, () -> vals.put("NEW", State.TO_VERIFY));
}

@Test
void testValues_notEmpty() {
assertFalse(State.values().isEmpty());
}

@Test
void testValues_containsPredefinedKeys() {
Map<String, State> vals = State.values();
assertTrue(vals.containsKey("TO_VERIFY"));
assertTrue(vals.containsKey("CONFIRMED"));
assertTrue(vals.containsKey("IGNORED"));
assertTrue(vals.containsKey("NOT_EXPLOITABLE"));
assertTrue(vals.containsKey("URGENT"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package checkmarx.ast.eclipse.plugin.tests.unit.utils;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.utils.CxLogger;

class CxLoggerTest {

@Test
void testWarning_doesNotThrow() {
assertDoesNotThrow(() -> CxLogger.warning("test-warning-message"));
}

@Test
void testError_withException_doesNotThrow() {
assertDoesNotThrow(() -> CxLogger.error("test-error-message", new RuntimeException("test")));
}

@Test
void testInfo_doesNotThrow() {
assertDoesNotThrow(() -> CxLogger.info("test-info-message"));
}
}
Loading
Loading