Skip to content

Commit

Permalink
test: fix context test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
1abhishekpandey committed Dec 1, 2022
1 parent 777c236 commit d149901
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import static org.junit.Assert.fail;

import com.google.common.collect.ImmutableMap;
import com.rudderstack.sdk.java.analytics.AnalyticsVersion;
import com.rudderstack.sdk.java.analytics.TestUtils;
import com.squareup.burst.BurstJUnit4;
import java.util.Date;
import java.util.Map;
import java.util.UUID;

import java.util.*;

import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -209,8 +210,13 @@ public void invalidContextThrows(TestUtils.MessageBuilderFactory builder) {

@Test
public void context(TestUtils.MessageBuilderFactory builder) {
Map<String, String> context = ImmutableMap.of("foo", "bar");
Map<String, String> library = new HashMap<>();
library.put("name", "analytics-java");
library.put("version", AnalyticsVersion.get());
Map<String, Object> context = ImmutableMap.of("foo", "bar", "library", library);

Message message = builder.get().userId("foo").context(context).build();

assertThat(message.context()).isEqualTo(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public class RudderAnalyticsClientTest {
private int MAX_MSG_SIZE = 1024 * 32; // 32kb //This is the limit for a message object
private int MSG_MAX_CREATE_SIZE =
MAX_MSG_SIZE
- 200; // Once we create msg object with this size it barely below 32 threshold so good
- 200 - 55; // Once we create msg object with this size it barely below 32 threshold so good
// (55 bytes is the context object size attached per message)
// for tests

@Test
Expand Down

0 comments on commit d149901

Please sign in to comment.