From b63ff659e1c70b50e981783ab03aa54fc0e2b5aa Mon Sep 17 00:00:00 2001 From: vasiliy-mikhailov Date: Wed, 24 Jun 2026 10:05:33 +0300 Subject: [PATCH] Add unit tests for MatomoRequests Additive unit tests only - no existing test or production code changed. Signed-off-by: vasiliy-mikhailov --- .../org/matomo/java/tracking/MatomoRequestsTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/test/java/org/matomo/java/tracking/MatomoRequestsTest.java b/core/src/test/java/org/matomo/java/tracking/MatomoRequestsTest.java index fe18ccf..26c8625 100644 --- a/core/src/test/java/org/matomo/java/tracking/MatomoRequestsTest.java +++ b/core/src/test/java/org/matomo/java/tracking/MatomoRequestsTest.java @@ -282,4 +282,16 @@ void crashDoesNotIncludeStackTraceIfStackTraceOfThrowableIsEmpty() { assertThat(request.getCrashLine()).isNull(); assertThat(request.getCrashColumn()).isNull(); } + + @Test + void crashWithThrowableHavingStackTraceIncludesLocationAndLine() { + RuntimeException throwable = new RuntimeException("real error"); + MatomoRequest.MatomoRequestBuilder builder = MatomoRequests.crash(throwable, "test category"); + MatomoRequest request = builder.build(); + assertThat(request.getCrashMessage()).isEqualTo("real error"); + assertThat(request.getCrashType()).isEqualTo("java.lang.RuntimeException"); + assertThat(request.getCrashCategory()).isEqualTo("test category"); + assertThat(request.getCrashLocation()).isNotNull(); + assertThat(request.getCrashLine()).isNotNull(); + } }