@Test public void testDelete() throws Exception { MockResponse response = new MockResponse() .addHeader("Content-Type", "application/json; charset=utf-8") .setBody("{}"); server.enqueue(response); MyApiMethods myApi = new Wasp.Builder(context) .setEndpoint(server.url("/v1").toString()) .setNetworkStack(VolleyNetworkStack.newInstance(requestQueue)) .build() .create(MyApiMethods.class); myApi.delete(); assertThat(server.takeRequest().getMethod()).isEqualTo("DELETE"); }
@SuppressWarnings("unchecked") public <T> T create(Class<T> service) { if (service == null) { throw new NullPointerException("service param may not be null"); } if (!service.isInterface()) { throw new IllegalArgumentException("Only interface type is supported"); } NetworkHandler handler = NetworkHandler.newInstance(service, builder); return (T) handler.getProxyClass(); }
Wasp { @SuppressWarnings("unchecked") public <T> T create(Class<T> service) { if (service == null) { throw new NullPointerException("service param may not be null"); } if (!service.isInterface()) { throw new IllegalArgumentException("Only interface type is supported"); } NetworkHandler handler = NetworkHandler.newInstance(service, builder); return (T) handler.getProxyClass(); } }
Wasp { @SuppressWarnings("unchecked") public <T> T create(Class<T> service) { if (service == null) { throw new NullPointerException("service param may not be null"); } if (!service.isInterface()) { throw new IllegalArgumentException("Only interface type is supported"); } NetworkHandler handler = NetworkHandler.newInstance(service, builder); return (T) handler.getProxyClass(); } private  Wasp(Builder builder); }
Wasp { @SuppressWarnings("unchecked") public <T> T create(Class<T> service) { if (service == null) { throw new NullPointerException("service param may not be null"); } if (!service.isInterface()) { throw new IllegalArgumentException("Only interface type is supported"); } NetworkHandler handler = NetworkHandler.newInstance(service, builder); return (T) handler.getProxyClass(); } private  Wasp(Builder builder); static Parser getParser(); @SuppressWarnings("unchecked") T create(Class<T> service); }
Wasp { @SuppressWarnings("unchecked") public <T> T create(Class<T> service) { if (service == null) { throw new NullPointerException("service param may not be null"); } if (!service.isInterface()) { throw new IllegalArgumentException("Only interface type is supported"); } NetworkHandler handler = NetworkHandler.newInstance(service, builder); return (T) handler.getProxyClass(); } private  Wasp(Builder builder); static Parser getParser(); @SuppressWarnings("unchecked") T create(Class<T> service);  }