Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit fd4aa10

Browse files
test: add 34 tests for GraphResilienceAnalyzer
fix: correct self-referencing LOGGER initialization in Main.java GraphResilienceAnalyzer had zero test coverage despite implementing three attack simulation strategies for network resilience analysis. Tests cover: Pre-analysis guards: - getDegreeAttackCurve/getBetweennessAttackCurve/getRandomAttackCurve all throw IllegalStateException before analyze() is called - getSummary/exportCSV throw before analyze() Degree-based attack: - First step captures full graph state (LCC=N, components=1) - Curve length is N+1 (initial + N removals) - Last step has 0 nodes remaining - Star graph: center (highest degree) removed first, all leaves become isolated (LCC=1, 5 components) Betweenness-based attack: - Path graph: v2 (highest betweenness) removed first - LCC monotonically decreases across curve Random attack: - Curve length is N+1 - First step has full graph, last step has 0 LCC - Custom trial count works correctly - setRandomTrials(0) clamped to 1 Robustness index: - Always in [0, 1] range - Null/empty curve returns 0 - Complete graph more resilient than star (degree attack) - Star: random attack shows higher resilience than degree attack Global efficiency: - Triangle has efficiency 1.0 (all pairs distance 1) - Efficiency decreases after node removal Edge cases: - Single node graph: 2-step curve - Two-node graph: 3-step curve with correct LCC progression - Disconnected graph (two triangles): correct LCC=3, components=2 Summary/Export: - Contains expected sections and formatting - CSV has correct header and line count Also fixes Main.java line 54: LOGGER was self-referencing (private static final Logger LOGGER = LOGGER) instead of calling Logger.getLogger(Main.class.getName()) — this was introduced during the logger consolidation in commit bfb05d4.
1 parent bfb05d4 commit fd4aa10

2 files changed

Lines changed: 494 additions & 1 deletion

File tree

Gvisual/src/gvisual/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
*/
5252
public class Main extends JFrame {
5353

54-
private static final Logger LOGGER = LOGGER;
54+
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
5555
private static final Color DEFAULT_BG_COLOR = Color.BLACK;
5656
private static final Color Vertex_COLOR = Color.WHITE;
5757
private static int DELAY = 2048;

0 commit comments

Comments
 (0)