diff options
author | Jeff Gaston <jeffrygaston@google.com> | 2017-05-22 17:04:47 -0700 |
---|---|---|
committer | Jeff Gaston <jeffrygaston@google.com> | 2017-05-22 17:13:44 -0700 |
commit | 369c1a464f4b750a0df7a750d5ab6bcc90202697 (patch) | |
tree | c93d8c578354ad447bf2871b69cbf5374869651e /org.jacoco.core.test | |
parent | ce2d33f3145d39d9e9aa6e8b59d409f803a13955 (diff) | |
parent | 0e905ab139d981b47dc4ba121d0f58d5b7f6a968 (diff) | |
download | jacoco-369c1a464f4b750a0df7a750d5ab6bcc90202697.tar.gz |
Merge remote-tracking branch 'aosp/upstream-pull-525' into masterandroid-o-preview-3
* aosp/upstream-pull-525:
Increase checked size for build result
Fix description.
Remove unnecessary .gitignore
New option -quiet for all commands
Tests for XML documentation generator.
Test and documentation for multiple values.
Adjust test case names to new conventions.
Command to print version.
Update documentation for command line interface
Close ServerSocket in tests.
Wrap long usage lines in documentation.
Make sure the build runs with Java 5.
Flush output automatically
Use -dest for option name as output can be folder or file.
Correct test method naming.
Remove obsolete, commented configuration.
Github #525: Simple Command Line Interface
Change-Id: Ia4c47f78760fc756ecc029ff4bc21d265e22d82a
Diffstat (limited to 'org.jacoco.core.test')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/tools/ExecDumpClientTest.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/tools/ExecDumpClientTest.java b/org.jacoco.core.test/src/org/jacoco/core/tools/ExecDumpClientTest.java index 3fe1688f..80918149 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/tools/ExecDumpClientTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/tools/ExecDumpClientTest.java @@ -101,7 +101,7 @@ public class ExecDumpClientTest { // 3. Retry "onConnectionFailure", "onConnecting") - , callbacks); + , callbacks); } @Test @@ -126,6 +126,12 @@ public class ExecDumpClientTest { assertTrue(resetRequested); } + @Test(expected = IOException.class) + public void testNopServer() throws IOException { + int port = createNopServer(); + client.dump((String) null, port); + } + private int getFreePort() throws IOException { final ServerSocket server = new ServerSocket(0, 0, InetAddress.getByName(null)); @@ -159,11 +165,27 @@ public class ExecDumpClientTest { dumpRequested = dump; resetRequested = reset; if (dump) { - writer.visitSessionInfo(new SessionInfo("TestId", 100, 200)); + writer.visitSessionInfo( + new SessionInfo("TestId", 100, 200)); } writer.sendCmdOk(); } }); reader.read(); } + + private int createNopServer() throws IOException { + server = new ServerSocket(0, 0, InetAddress.getByName(null)); + new Thread(new Runnable() { + public void run() { + try { + server.accept().close(); + } catch (IOException e) { + // ignore + } + } + }).start(); + return server.getLocalPort(); + } + } |