@Test public void uri_type_request_asks_context_for_url() { this.uriBuilder.create(URI.class, this.mockSpecimenContext); verify(this.mockSpecimenContext).resolve(URL.class); }
@Override public Object create(Object request, SpecimenContext context) { if (!request.equals(URI.class)) { return new NoSpecimen(); } Object specimen = context.resolve(URL.class); if (!(specimen instanceof URL)) { return new NoSpecimen(); } URL url = (URL) specimen; try { return url.toURI(); } catch (URISyntaxException e) { return new NoSpecimen(); } }
UriBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(URI.class)) { return new NoSpecimen(); } Object specimen = context.resolve(URL.class); if (!(specimen instanceof URL)) { return new NoSpecimen(); } URL url = (URL) specimen; try { return url.toURI(); } catch (URISyntaxException e) { return new NoSpecimen(); } } }
UriBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(URI.class)) { return new NoSpecimen(); } Object specimen = context.resolve(URL.class); if (!(specimen instanceof URL)) { return new NoSpecimen(); } URL url = (URL) specimen; try { return url.toURI(); } catch (URISyntaxException e) { return new NoSpecimen(); } }  }
UriBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(URI.class)) { return new NoSpecimen(); } Object specimen = context.resolve(URL.class); if (!(specimen instanceof URL)) { return new NoSpecimen(); } URL url = (URL) specimen; try { return url.toURI(); } catch (URISyntaxException e) { return new NoSpecimen(); } }  @Override Object create(Object request, SpecimenContext context); }
UriBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(URI.class)) { return new NoSpecimen(); } Object specimen = context.resolve(URL.class); if (!(specimen instanceof URL)) { return new NoSpecimen(); } URL url = (URL) specimen; try { return url.toURI(); } catch (URISyntaxException e) { return new NoSpecimen(); } }  @Override Object create(Object request, SpecimenContext context);  }