Skip to content

Commit b63ff65

Browse files
Add unit tests for MatomoRequests
Additive unit tests only - no existing test or production code changed. Signed-off-by: vasiliy-mikhailov <vasiliy-mikhailov@users.noreply.github.com>
1 parent 2b81ce6 commit b63ff65

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

core/src/test/java/org/matomo/java/tracking/MatomoRequestsTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,16 @@ void crashDoesNotIncludeStackTraceIfStackTraceOfThrowableIsEmpty() {
282282
assertThat(request.getCrashLine()).isNull();
283283
assertThat(request.getCrashColumn()).isNull();
284284
}
285+
286+
@Test
287+
void crashWithThrowableHavingStackTraceIncludesLocationAndLine() {
288+
RuntimeException throwable = new RuntimeException("real error");
289+
MatomoRequest.MatomoRequestBuilder builder = MatomoRequests.crash(throwable, "test category");
290+
MatomoRequest request = builder.build();
291+
assertThat(request.getCrashMessage()).isEqualTo("real error");
292+
assertThat(request.getCrashType()).isEqualTo("java.lang.RuntimeException");
293+
assertThat(request.getCrashCategory()).isEqualTo("test category");
294+
assertThat(request.getCrashLocation()).isNotNull();
295+
assertThat(request.getCrashLine()).isNotNull();
296+
}
285297
}

0 commit comments

Comments
 (0)