Beispiele#
JUnit-Test#
public class MockTest { @BeforeClass public static void beforeClass() { MapMockServer server = new MapMockServer(); server.add("test://localhost/test", "Test-Response"); ProtocolFactory.register(new MockProtocol("test", server)); } @Test public void test() throws IOException { URL url = new URL("test://localhost/test"); String response = IOUtils.readString(url.openStream()); Assert.assertEquals("Test-Response", response); } }