From 0a278056e50377d13fed935e6b361a243b28d7da Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Mon, 6 Nov 2023 11:48:56 +0000 Subject: [PATCH] fix: include posthog library property in events (#48) --- .../src/main/java/com/posthog/java/PostHog.java | 1 + .../test/java/com/posthog/java/PostHogTest.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/posthog/src/main/java/com/posthog/java/PostHog.java b/posthog/src/main/java/com/posthog/java/PostHog.java index 281827a..5b4191f 100644 --- a/posthog/src/main/java/com/posthog/java/PostHog.java +++ b/posthog/src/main/java/com/posthog/java/PostHog.java @@ -191,6 +191,7 @@ private JSONObject getEventJson(String event, String distinctId, Map() { + { + put("movie_id", 123); + put("category", "romcom"); + } + }); + ph.shutdown(); + assertEquals(1, sender.calls.size()); + assertEquals(1, sender.calls.get(0).size()); + JSONObject json = sender.calls.get(0).get(0); + assertThatJson("{\"$lib\":\"posthog-java\"}").isEqualTo(new JSONObject(json, "$lib").toString()); + } + @Test public void testIdentifySimple() { ph.identify("test id", new HashMap() {