|
18 | 18 | package org.openqa.grid.e2e.misc;
|
19 | 19 |
|
20 | 20 | import static org.hamcrest.CoreMatchers.containsString;
|
| 21 | +import static org.hamcrest.CoreMatchers.startsWith; |
21 | 22 | import static org.junit.Assert.assertEquals;
|
22 | 23 | import static org.junit.Assert.assertThat;
|
23 | 24 |
|
@@ -54,7 +55,42 @@ public void unrecognizedRole() throws Exception {
|
54 | 55 | String[] args = {"-role", "hamlet"};
|
55 | 56 | new GridLauncherV3(new PrintStream(outSpy), args).launch();
|
56 | 57 | assertThat(outSpy.toString(),
|
57 |
| - containsString("Error: the role 'hamlet' does not match a recognized server role")); |
| 58 | + startsWith("Error: the role 'hamlet' does not match a recognized server role")); |
| 59 | + } |
| 60 | + |
| 61 | + @Test |
| 62 | + public void canPrintVersion() throws Exception { |
| 63 | + ByteArrayOutputStream outSpy = new ByteArrayOutputStream(); |
| 64 | + String[] args = {"-version"}; |
| 65 | + new GridLauncherV3(new PrintStream(outSpy), args).launch(); |
| 66 | + assertThat(outSpy.toString(), startsWith("Selenium server version: ")); |
| 67 | + } |
| 68 | + |
| 69 | + @Test |
| 70 | + public void canPrintGeneralHelp() throws Exception { |
| 71 | + ByteArrayOutputStream outSpy = new ByteArrayOutputStream(); |
| 72 | + String[] args = {"-help"}; |
| 73 | + new GridLauncherV3(new PrintStream(outSpy), args).launch(); |
| 74 | + assertThat(outSpy.toString(), startsWith("Usage: <main class> [options]")); |
| 75 | + assertThat(outSpy.toString(), containsString("-role")); |
| 76 | + } |
| 77 | + |
| 78 | + @Test |
| 79 | + public void canPrintHubHelp() throws Exception { |
| 80 | + ByteArrayOutputStream outSpy = new ByteArrayOutputStream(); |
| 81 | + String[] args = {"-role", "hub", "-help"}; |
| 82 | + new GridLauncherV3(new PrintStream(outSpy), args).launch(); |
| 83 | + assertThat(outSpy.toString(), startsWith("Usage: <main class> [options]")); |
| 84 | + assertThat(outSpy.toString(), containsString("-hubConfig")); |
| 85 | + } |
| 86 | + |
| 87 | + @Test |
| 88 | + public void canPrintNodeHelp() throws Exception { |
| 89 | + ByteArrayOutputStream outSpy = new ByteArrayOutputStream(); |
| 90 | + String[] args = {"-role", "node", "-help"}; |
| 91 | + new GridLauncherV3(new PrintStream(outSpy), args).launch(); |
| 92 | + assertThat(outSpy.toString(), startsWith("Usage: <main class> [options]")); |
| 93 | + assertThat(outSpy.toString(), containsString("-nodeConfig")); |
58 | 94 | }
|
59 | 95 |
|
60 | 96 | @Test
|
|
0 commit comments