TrackMe { public synchronized TrackMe set(@NonNull String key, String value) { if (value == null) mQueryParams.remove(key); else if (value.length() > 0) mQueryParams.put(key, value); return this; } TrackMe();  TrackMe(TrackMe trackMe); TrackMe putAll(@NonNull TrackMe trackMe); synchronized TrackMe set(@NonNull String key, String value); @Nullable synchronized String get(@NonNull String queryParams); synchronized TrackMe set(@NonNull QueryParams key, String value); synchronized TrackMe set(@NonNull QueryParams key, int value); synchronized TrackMe set(@NonNull QueryParams key, float value); synchronized TrackMe set(@NonNull QueryParams key, long value); synchronized boolean has(@NonNull QueryParams queryParams); synchronized TrackMe trySet(@NonNull QueryParams key, int value); synchronized TrackMe trySet(@NonNull QueryParams key, float value); synchronized TrackMe trySet(@NonNull QueryParams key, long value); synchronized TrackMe trySet(@NonNull QueryParams key, String value); synchronized Map<String, String> toMap(); synchronized String get(@NonNull QueryParams queryParams); synchronized boolean isEmpty();  }
@Test public void testSet() throws Exception { TrackMe trackMe = new TrackMe(); trackMe.set(QueryParams.HOURS, "String"); assertEquals("String", trackMe.get(QueryParams.HOURS)); trackMe = new TrackMe(); trackMe.set(QueryParams.HOURS, 1f); assertEquals(String.valueOf(1f), trackMe.get(QueryParams.HOURS)); trackMe = new TrackMe(); trackMe.set(QueryParams.HOURS, 1L); assertEquals(String.valueOf(1L), trackMe.get(QueryParams.HOURS)); trackMe = new TrackMe(); trackMe.set(QueryParams.HOURS, 1); assertEquals(String.valueOf(1), trackMe.get(QueryParams.HOURS)); trackMe = new TrackMe(); trackMe.set(QueryParams.HOURS, null); assertNull(trackMe.get(QueryParams.HOURS)); }