Skip to content

Commit 9045565

Browse files
committed
Whoa! Reformatting!
1 parent 7804d11 commit 9045565

File tree

98 files changed

+1868
-1872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1868
-1872
lines changed

Diff for: rest-client-driver/src/main/java/com/github/restdriver/clientdriver/ClientDriver.java

+21-23
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
* The main class which acts as a facade for the Client Driver.
2929
*/
3030
public final class ClientDriver {
31-
31+
3232
private final Server jettyServer;
3333
private final int port;
34-
34+
3535
private final ClientDriverJettyHandler handler;
36-
36+
3737
/**
3838
* Constructor. This will find a free port, bind to it and start the server
3939
* up before it returns.
@@ -44,7 +44,7 @@ public final class ClientDriver {
4444
public ClientDriver(ClientDriverJettyHandler handler) {
4545
this(handler, getFreePort());
4646
}
47-
47+
4848
/**
4949
* Constructor. This will find a free port, bind to it and start the server
5050
* up before it returns.
@@ -56,28 +56,28 @@ public ClientDriver(ClientDriverJettyHandler handler) {
5656
* not free.
5757
*/
5858
public ClientDriver(ClientDriverJettyHandler handler, int port) {
59-
59+
6060
this.port = port;
6161
this.handler = handler;
62-
62+
6363
jettyServer = new Server(port);
64-
64+
6565
startJetty();
6666
}
67-
67+
6868
private void startJetty() {
69-
69+
7070
try {
7171
jettyServer.setHandler(handler.getJettyHandler());
7272
jettyServer.start();
73-
73+
7474
} catch (Exception e) {
7575
throw new ClientDriverSetupException(
7676
"Error starting jetty on port " + port, e);
77-
77+
7878
}
7979
}
80-
80+
8181
/**
8282
* Get the base URL which the ClientDriver is running on.
8383
*
@@ -87,7 +87,7 @@ private void startJetty() {
8787
public String getBaseUrl() {
8888
return "http://localhost:" + port;
8989
}
90-
90+
9191
/**
9292
* Gets a free port on localhost for binding to.
9393
*
@@ -96,24 +96,23 @@ public String getBaseUrl() {
9696
* @return The port number.
9797
*/
9898
public static int getFreePort() {
99-
99+
100100
try {
101101
ServerSocket server = new ServerSocket(0);
102102
int port = server.getLocalPort();
103103
server.close();
104104
return port;
105-
105+
106106
} catch (IOException ioe) {
107107
throw new ClientDriverSetupException(
108108
"IOException finding free port", ioe);
109109
}
110110
}
111-
111+
112112
/**
113113
* Verifies that all expectations have been met and nothing unexpected has been requested.
114114
*
115-
* If the verification fails, a {@link com.github.restdriver.clientdriver.exception.ClientDriverFailedExpectationException}
116-
* is thrown with plenty of detail, and your test will fail!
115+
* If the verification fails, a {@link com.github.restdriver.clientdriver.exception.ClientDriverFailedExpectationException} is thrown with plenty of detail, and your test will fail!
117116
*/
118117
public void verify() {
119118
handler.checkForUnexpectedRequests();
@@ -130,24 +129,23 @@ public void shutdownQuietly() {
130129
throw new ClientDriverFailedExpectationException("Error shutting down jetty", e);
131130
}
132131
}
133-
132+
134133
/**
135134
* Shutdown the server and calls {@link #verify()}.
136135
*/
137136
public void shutdown() {
138137
shutdownQuietly();
139138
verify();
140139
}
141-
140+
142141
/**
143-
* Add in an expected {@link ClientDriverRequest}/
144-
* {@link ClientDriverResponse} pair.
142+
* Add in an expected {@link ClientDriverRequest}/ {@link ClientDriverResponse} pair.
145143
*
146144
* @param request
147145
* The expected request
148146
* @param response
149147
* The response to serve to that request
150-
*
148+
*
151149
* @return The newly added expectation.
152150
*/
153151
public ClientDriverExpectation addExpectation(ClientDriverRequest request,

Diff for: rest-client-driver/src/main/java/com/github/restdriver/clientdriver/ClientDriverExpectation.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
* An expectation made within the client driver.
2222
*/
2323
public class ClientDriverExpectation {
24-
24+
2525
private final ClientDriverRequestResponsePair pair;
2626
private int numberOfTimes = 1;
2727
private int numberOfMatches;
2828
private boolean matchAnyTimes;
29-
29+
3030
/**
3131
* Creates a new expectation instance.
3232
*
@@ -35,7 +35,7 @@ public class ClientDriverExpectation {
3535
public ClientDriverExpectation(ClientDriverRequestResponsePair pair) {
3636
this.pair = pair;
3737
}
38-
38+
3939
/**
4040
* Gets the request/response pair this expectation covers.
4141
*
@@ -44,7 +44,7 @@ public ClientDriverExpectation(ClientDriverRequestResponsePair pair) {
4444
public final ClientDriverRequestResponsePair getPair() {
4545
return pair;
4646
}
47-
47+
4848
/**
4949
* Indicate that this expectation should be matched a given number of times.
5050
*
@@ -56,21 +56,21 @@ public final void times(int times) {
5656
}
5757
numberOfTimes = times;
5858
}
59-
59+
6060
/**
6161
* Indicate that this expectation should be matched any number of times.
6262
*/
6363
public final void anyTimes() {
6464
matchAnyTimes = true;
6565
}
66-
66+
6767
/**
6868
* Indicate that this expectation has been matched.
6969
*/
7070
public final void match() {
7171
numberOfMatches += 1;
7272
}
73-
73+
7474
/**
7575
* Determine whether this expectation has been satisfied.
7676
*
@@ -79,7 +79,7 @@ public final void match() {
7979
public final boolean isSatisfied() {
8080
return !matchAnyTimes && numberOfTimes == numberOfMatches;
8181
}
82-
82+
8383
/**
8484
* Whether this expectation should match any number of times.
8585
*
@@ -88,24 +88,24 @@ public final boolean isSatisfied() {
8888
public final boolean shouldMatchAnyTimes() {
8989
return matchAnyTimes;
9090
}
91-
91+
9292
/**
9393
* Gets a string giving the status of the expectation.
9494
*
9595
* @return The status string
9696
*/
9797
public final String getStatusString() {
98-
98+
9999
String expectedString;
100-
100+
101101
if (matchAnyTimes) {
102102
expectedString = "any";
103103
} else {
104104
expectedString = String.valueOf(numberOfTimes);
105105
}
106-
106+
107107
return "expected: " + expectedString + ", actual: " + numberOfMatches;
108-
108+
109109
}
110-
110+
111111
}

Diff for: rest-client-driver/src/main/java/com/github/restdriver/clientdriver/ClientDriverFactory.java

+13-14
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,30 @@
2121
* Main entry point to the Rest Client Driver.
2222
*/
2323
public final class ClientDriverFactory {
24-
24+
2525
/**
26-
* Factory method to create and start a {@link ClientDriver}. A port will be chosen automatically.
26+
* Factory method to create and start a {@link ClientDriver}. A port will be chosen automatically.
2727
*
2828
* @return A new {@link ClientDriver}, which has found a free port, bound to it and started up.
2929
*/
3030
public ClientDriver createClientDriver() {
31-
31+
3232
return new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()));
33-
33+
3434
}
35-
35+
3636
/**
37-
* Factory method to create and start a {@link ClientDriver} on a specific port. This is <em>absolutely</em> not the recommended
38-
* way to use the client driver. The no-arg method will choose a free port, use of this method will fail if the port is not free.
39-
*
40-
* @param port The port to listen on. If this port is not available a runtime exception will be thrown.
41-
*
37+
* Factory method to create and start a {@link ClientDriver} on a specific port. This is <em>absolutely</em> not the recommended
38+
* way to use the client driver. The no-arg method will choose a free port, use of this method will fail if the port is not free.
39+
*
40+
* @param port The port to listen on. If this port is not available a runtime exception will be thrown.
41+
*
4242
* @return A new {@link ClientDriver}, which has found a free port, bound to it and started up.
4343
*/
4444
public ClientDriver createClientDriver(int port) {
45-
45+
4646
return new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()), port);
47-
47+
4848
}
49-
50-
49+
5150
}

0 commit comments

Comments
 (0)