CacheArgumentServices { public String computeArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames) { if (keys.length == 0) { return ""; } else if (Constants.Cache.USE_ALL_ARGUMENTS.equals(keys[0])) { return Arrays.toString(jsonArgs.toArray(new String[jsonArgs.size()])); } else { return computeSpecifiedArgPart(keys, jsonArgs, paramNames); } }  String computeArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames);  }
@Test public void testComputeArgPart_none() { System.out.println("computeArgPart"); String[] keys = new String[] {}; String result = instance.computeArgPart(keys, null, null); assertThat(result).isEqualTo(""); }
@Test public void testComputeArgPart_all() { System.out.println("computeArgPart"); String[] keys = new String[] {"*"}; List<String> jsonArgs = Arrays.asList("5", "\"foo\""); String result = instance.computeArgPart(keys, jsonArgs, null); assertThat(result).isEqualTo("[5, \"foo\"]"); }
@Test public void testComputeArgPart() { System.out.println("computeArgPart"); String[] keys = new String[] {"a", "b", "c.d"}; List<String> jsonArgs = Arrays.asList("5", "\"foo\"", "{\"d\":5, \"e\":6}"); List<String> paramNames = Arrays.asList("a", "b", "c"); doReturn("computed").when(instance).computeSpecifiedArgPart(any(String[].class), anyListOf(String.class), anyListOf(String.class)); String result = instance.computeArgPart(keys, jsonArgs, paramNames); assertThat(result).isEqualTo("computed"); }