@Test public void testMockCollections() { MyResultWithCollections resultList = MockUtils.generateMockResponse(MyResultWithCollections.class, mock(RequestContext.class)); assertEquals("String", resultList.foo.substring(0, 6)); for (MyResult r: resultList.list) { checkResult(r); } for (String s: resultList.set) { assertEquals("String", s.substring(0, 6)); } for (Map.Entry<String, MyResult> me: resultList.map.entrySet()) { assertEquals("String", me.getKey().substring(0, 6)); checkResult(me.getValue()); } }
public static <T> T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ) { try { Generator generator = new Generator(); T responseObject = generateObject(responseClass, generator); return responseObject; } catch (Exception e) { throw new RuntimeException("Failed to generate response object: "+e.getMessage(), e); } }
MockUtils { public static <T> T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ) { try { Generator generator = new Generator(); T responseObject = generateObject(responseClass, generator); return responseObject; } catch (Exception e) { throw new RuntimeException("Failed to generate response object: "+e.getMessage(), e); } } }
MockUtils { public static <T> T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ) { try { Generator generator = new Generator(); T responseObject = generateObject(responseClass, generator); return responseObject; } catch (Exception e) { throw new RuntimeException("Failed to generate response object: "+e.getMessage(), e); } }  }
MockUtils { public static <T> T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ) { try { Generator generator = new Generator(); T responseObject = generateObject(responseClass, generator); return responseObject; } catch (Exception e) { throw new RuntimeException("Failed to generate response object: "+e.getMessage(), e); } }  static T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ); }
MockUtils { public static <T> T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params ) { try { Generator generator = new Generator(); T responseObject = generateObject(responseClass, generator); return responseObject; } catch (Exception e) { throw new RuntimeException("Failed to generate response object: "+e.getMessage(), e); } }  static T generateMockResponse(Class<T> responseClass, RequestContext ctx, Object... params );  }