This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit fd4aa10
committed
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments