Precompute matched-transition link keys for HTML export

Embed linkKey on matchedTransitions in HTML metadata so explorer highlighting uses the same SVG #link_* suffix as PlantUML, avoiding JS/Java format drift while keeping golden JSON unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-14 06:46:23 +02:00
parent 32fe96041c
commit 00d1f24709
6 changed files with 142 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
package click.kamil.springstatemachineexporter.exporter;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class TransitionLinkKeyTest {
@Test
void shouldBuildFnFormLinkKeyFromPackageCanonicalIdentifiers() {
assertThat(TransitionLinkKey.build(
"com.example.order.OrderState.NEW",
"com.example.order.OrderEvent.PAY"))
.isEqualTo("OrderState_NEW__OrderEvent_PAY");
}
@Test
void shouldBuildFqnFormLinkKeyWhenRequested() {
assertThat(TransitionLinkKey.build(
"com.example.order.OrderState.NEW",
"com.example.order.OrderEvent.PAY",
EnumFormat.fqn,
EnumFormat.fqn))
.isEqualTo("com_example_order_OrderState_NEW__com_example_order_OrderEvent_PAY");
}
@Test
void shouldBuildEventOnlyLinkKeyWhenSourceMissing() {
assertThat(TransitionLinkKey.build(null, "com.example.order.OrderEvent.PAY"))
.isEqualTo("__OrderEvent_PAY");
}
}