@Test public void matchingRequestsHaveSameKey() throws Exception { Request request = new Request.Builder(URI_1).build(); String key1 = createKey(request); String key2 = createKey(request); assertThat(key1).isEqualTo(key2); Transformation t1 = new TestTransformation("foo", null); Transformation t2 = new TestTransformation("foo", null); Request requestTransform1 = new Request.Builder(URI_1).transform(t1).build(); Request requestTransform2 = new Request.Builder(URI_1).transform(t2).build(); String single1 = createKey(requestTransform1); String single2 = createKey(requestTransform2); assertThat(single1).isEqualTo(single2); Transformation t3 = new TestTransformation("foo", null); Transformation t4 = new TestTransformation("bar", null); Request requestTransform3 = new Request.Builder(URI_1).transform(t3).transform(t4).build(); Request requestTransform4 = new Request.Builder(URI_1).transform(t3).transform(t4).build(); String double1 = createKey(requestTransform3); String double2 = createKey(requestTransform4); assertThat(double1).isEqualTo(double2); Transformation t5 = new TestTransformation("foo", null); Transformation t6 = new TestTransformation("bar", null); Request requestTransform5 = new Request.Builder(URI_1).transform(t5).transform(t6).build(); Request requestTransform6 = new Request.Builder(URI_1).transform(t6).transform(t5).build(); String order1 = createKey(requestTransform5); String order2 = createKey(requestTransform6); assertThat(order1).isNotEqualTo(order2); }
static String createKey(Request data) { String result = createKey(data, MAIN_THREAD_KEY_BUILDER); MAIN_THREAD_KEY_BUILDER.setLength(0); return result; }
Utils { static String createKey(Request data) { String result = createKey(data, MAIN_THREAD_KEY_BUILDER); MAIN_THREAD_KEY_BUILDER.setLength(0); return result; } }
Utils { static String createKey(Request data) { String result = createKey(data, MAIN_THREAD_KEY_BUILDER); MAIN_THREAD_KEY_BUILDER.setLength(0); return result; } private  Utils(); }
Utils { static String createKey(Request data) { String result = createKey(data, MAIN_THREAD_KEY_BUILDER); MAIN_THREAD_KEY_BUILDER.setLength(0); return result; } private  Utils();  }
Utils { static String createKey(Request data) { String result = createKey(data, MAIN_THREAD_KEY_BUILDER); MAIN_THREAD_KEY_BUILDER.setLength(0); return result; } private  Utils();   }