Skip to content

Commit f09cea2

Browse files
author
ci.datadog-api-spec
committed
pre-commit fixes
1 parent 33640b8 commit f09cea2

File tree

2 files changed

+55
-110
lines changed

2 files changed

+55
-110
lines changed

src/test/java/com/datadog/api/ClientSteps.java

Lines changed: 39 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ public void setupVersion(Scenario scenario) {
5555

5656
@Before(order = 10)
5757
public void setupClient()
58-
throws java.lang.reflect.InvocationTargetException,
59-
java.lang.IllegalAccessException,
60-
java.lang.InstantiationException,
61-
java.lang.NoSuchMethodException,
62-
java.lang.ClassNotFoundException,
63-
java.lang.NoSuchFieldException {
58+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
59+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
60+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
6461
world.setupClient(apiVersion);
6562
}
6663

@@ -100,31 +97,24 @@ public void undo() {
10097

10198
@Given("an instance of {string} API")
10299
public void anInstanceOfAPI(String apiName)
103-
throws java.lang.ClassNotFoundException,
104-
java.lang.NoSuchFieldException,
105-
java.lang.InstantiationException,
106-
java.lang.IllegalAccessException,
107-
java.lang.NoSuchMethodException,
108-
java.lang.reflect.InvocationTargetException {
100+
throws java.lang.ClassNotFoundException, java.lang.NoSuchFieldException,
101+
java.lang.InstantiationException, java.lang.IllegalAccessException,
102+
java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException {
109103
world.setupAPI(apiVersion, World.toClassName(apiName));
110104
}
111105

112106
@Given("operation {string} enabled")
113107
public void operationEnabled(String operationId)
114-
throws java.lang.reflect.InvocationTargetException,
115-
java.lang.IllegalAccessException,
116-
java.lang.InstantiationException,
117-
java.lang.NoSuchMethodException,
108+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
109+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
118110
java.lang.ClassNotFoundException {
119111
world.setUnstableOperationEnabled(apiVersion + "." + World.toMethodName(operationId));
120112
}
121113

122114
@Given("a valid \"apiKeyAuth\" key in the system")
123115
public void aValidApiKeyInTheSystem()
124-
throws java.lang.reflect.InvocationTargetException,
125-
java.lang.IllegalAccessException,
126-
java.lang.InstantiationException,
127-
java.lang.NoSuchMethodException,
116+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
117+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
128118
java.lang.ClassNotFoundException {
129119
HashMap<String, String> secrets = new HashMap<String, String>();
130120
secrets.put("apiKeyAuth", System.getenv(TEST_API_KEY_NAME));
@@ -133,10 +123,8 @@ public void aValidApiKeyInTheSystem()
133123

134124
@Given("a valid \"appKeyAuth\" key in the system")
135125
public void aValidAppKeyInTheSystem()
136-
throws java.lang.reflect.InvocationTargetException,
137-
java.lang.IllegalAccessException,
138-
java.lang.InstantiationException,
139-
java.lang.NoSuchMethodException,
126+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
127+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
140128
java.lang.ClassNotFoundException {
141129
HashMap<String, String> secrets = new HashMap<String, String>();
142130
secrets.put("appKeyAuth", System.getenv(TEST_APP_KEY_NAME));
@@ -145,53 +133,42 @@ public void aValidAppKeyInTheSystem()
145133

146134
@Given("new {string} request")
147135
public void newRequest(String methodName)
148-
throws java.lang.IllegalAccessException,
149-
java.lang.IllegalAccessException,
150-
java.lang.NoSuchMethodException,
151-
java.lang.reflect.InvocationTargetException {
136+
throws java.lang.IllegalAccessException, java.lang.IllegalAccessException,
137+
java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException {
152138
world.newRequest(methodName);
153139
}
154140

155141
@Given("request contains {string} parameter from {string}")
156142
public void requestContainsParameterFrom(String parameterName, String fixturePath)
157-
throws java.lang.IllegalAccessException,
158-
java.lang.NoSuchFieldException,
159-
java.lang.ClassNotFoundException,
160-
java.lang.NoSuchMethodException,
143+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
144+
java.lang.ClassNotFoundException, java.lang.NoSuchMethodException,
161145
java.lang.reflect.InvocationTargetException {
162146
world.addRequestParameterFixture(parameterName, fixturePath);
163147
}
164148

165149
@Given("request contains {string} parameter with value {}")
166150
public void requestContainsParameterWithValue(String parameterName, String value)
167-
throws java.lang.IllegalAccessException,
168-
java.lang.NoSuchFieldException,
169-
java.lang.ClassNotFoundException,
170-
java.lang.NoSuchMethodException,
151+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
152+
java.lang.ClassNotFoundException, java.lang.NoSuchMethodException,
171153
java.lang.reflect.InvocationTargetException,
172154
com.fasterxml.jackson.core.JsonProcessingException {
173155
world.addRequestParameter(parameterName, value);
174156
}
175157

176158
@Given("body with value {}")
177159
public void setBody(String data)
178-
throws java.lang.IllegalAccessException,
179-
java.lang.NoSuchFieldException,
180-
java.lang.ClassNotFoundException,
181-
java.lang.NoSuchMethodException,
160+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
161+
java.lang.ClassNotFoundException, java.lang.NoSuchMethodException,
182162
java.lang.reflect.InvocationTargetException,
183163
com.fasterxml.jackson.core.JsonProcessingException {
184164
world.addRequestParameter("body", data);
185165
}
186166

187167
@Given("body from file {string}")
188168
public void setBodyFromFile(String filename)
189-
throws java.lang.IllegalAccessException,
190-
java.lang.NoSuchFieldException,
191-
java.lang.ClassNotFoundException,
192-
java.lang.NoSuchMethodException,
193-
java.lang.reflect.InvocationTargetException,
194-
IOException {
169+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
170+
java.lang.ClassNotFoundException, java.lang.NoSuchMethodException,
171+
java.lang.reflect.InvocationTargetException, IOException {
195172
Path bodyPath =
196173
Paths.get("src/test/resources/com/datadog/api/client/" + apiVersion + "/api/" + filename);
197174
String data = new String(Files.readAllBytes(bodyPath));
@@ -200,10 +177,8 @@ public void setBodyFromFile(String filename)
200177

201178
@Then("the response status is {int} {}")
202179
public void theResponseStatusIs(Integer statusCode, String unused)
203-
throws java.lang.reflect.InvocationTargetException,
204-
java.lang.IllegalAccessException,
205-
java.lang.InstantiationException,
206-
java.lang.NoSuchMethodException,
180+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
181+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
207182
java.lang.ClassNotFoundException {
208183
Integer responseStatusCode = (Integer) 0;
209184

@@ -220,14 +195,10 @@ public void theResponseStatusIs(Integer statusCode, String unused)
220195

221196
@Then("the response {string} is equal to {}")
222197
public void theResponseIsEqualTo(String responsePath, String value)
223-
throws java.lang.IllegalAccessException,
224-
java.lang.NoSuchFieldException,
225-
java.lang.reflect.InvocationTargetException,
226-
java.lang.IllegalAccessException,
227-
java.lang.InstantiationException,
228-
java.lang.NoSuchMethodException,
229-
java.lang.ClassNotFoundException,
230-
com.fasterxml.jackson.core.JsonProcessingException {
198+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
199+
java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
200+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
201+
java.lang.ClassNotFoundException, com.fasterxml.jackson.core.JsonProcessingException {
231202
Object responseData = world.responseClass.getMethod("getData").invoke(world.response);
232203
Object responseValue = World.lookup(responseData, responsePath);
233204
if (responseValue != null) {
@@ -244,46 +215,36 @@ public void theResponseIsEqualTo(String responsePath, String value)
244215

245216
@Then("the response {string} is false")
246217
public void theResponseIsFalse(String responsePath)
247-
throws java.lang.reflect.InvocationTargetException,
248-
java.lang.IllegalAccessException,
249-
java.lang.InstantiationException,
250-
java.lang.NoSuchMethodException,
251-
java.lang.ClassNotFoundException,
252-
java.lang.NoSuchFieldException {
218+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
219+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
220+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
253221
Object responseData = world.responseClass.getMethod("getData").invoke(world.response);
254222
assertFalse((Boolean) World.lookup(responseData, responsePath));
255223
}
256224

257225
@Then("the response {string} has the same value as {string}")
258226
public void theResponseHasTheSameValueAs(String responsePath, String fixturePath)
259-
throws java.lang.reflect.InvocationTargetException,
260-
java.lang.IllegalAccessException,
261-
java.lang.InstantiationException,
262-
java.lang.NoSuchMethodException,
263-
java.lang.ClassNotFoundException,
264-
java.lang.NoSuchFieldException {
227+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
228+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
229+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
265230
Object responseData = world.responseClass.getMethod("getData").invoke(world.response);
266231
assertEquals(
267232
World.lookup(world.context, fixturePath), World.lookup(responseData, responsePath));
268233
}
269234

270235
@Then("the response {string} has length {long}")
271236
public void theResponseHasLength(String responsePath, Long size)
272-
throws java.lang.reflect.InvocationTargetException,
273-
java.lang.IllegalAccessException,
274-
java.lang.InstantiationException,
275-
java.lang.NoSuchMethodException,
276-
java.lang.ClassNotFoundException,
277-
java.lang.NoSuchFieldException {
237+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
238+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
239+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
278240
Object responseData = world.responseClass.getMethod("getData").invoke(world.response);
279241
List value = (List) World.lookup(responseData, responsePath);
280242
assertEquals(size, Long.valueOf(value.size()));
281243
}
282244

283245
@Then("the response has {int} items")
284246
public void theResponseHasItems(Integer size)
285-
throws java.lang.reflect.InvocationTargetException,
286-
java.lang.IllegalAccessException,
247+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
287248
java.lang.NoSuchMethodException {
288249
if (world.response.getClass().getSimpleName().equals("PaginationIterable")) {
289250
assertEquals(size, ((Object) world.paginatedItems.size()));

src/test/java/com/datadog/api/World.java

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,9 @@ public String getVersion() {
133133
}
134134

135135
private void configureClient(Class<?> clientClass, Object client)
136-
throws java.lang.reflect.InvocationTargetException,
137-
java.lang.IllegalAccessException,
138-
java.lang.InstantiationException,
139-
java.lang.NoSuchMethodException,
140-
java.lang.ClassNotFoundException,
141-
java.lang.NoSuchFieldException {
136+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
137+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
138+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
142139
// client.setServerIndex(0);
143140
clientClass.getMethod("setServerIndex", Integer.class).invoke(client, 0);
144141

@@ -192,12 +189,9 @@ private void configureClient(Class<?> clientClass, Object client)
192189
}
193190

194191
public void setupClient(String apiVersion)
195-
throws java.lang.reflect.InvocationTargetException,
196-
java.lang.IllegalAccessException,
197-
java.lang.InstantiationException,
198-
java.lang.NoSuchMethodException,
199-
java.lang.ClassNotFoundException,
200-
java.lang.NoSuchFieldException {
192+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
193+
java.lang.InstantiationException, java.lang.NoSuchMethodException,
194+
java.lang.ClassNotFoundException, java.lang.NoSuchFieldException {
201195
// import com.datadog.api.client.ApiClient
202196
clientClass = Class.forName("com.datadog.api.client.ApiClient");
203197
// client = new ApiClient()
@@ -206,10 +200,8 @@ public void setupClient(String apiVersion)
206200
}
207201

208202
public void setupAPI(String apiVersion, String apiName)
209-
throws java.lang.ClassNotFoundException,
210-
java.lang.InstantiationException,
211-
java.lang.IllegalAccessException,
212-
java.lang.NoSuchMethodException,
203+
throws java.lang.ClassNotFoundException, java.lang.InstantiationException,
204+
java.lang.IllegalAccessException, java.lang.NoSuchMethodException,
213205
java.lang.reflect.InvocationTargetException {
214206
// import com.datadog.api.{{ apiVersion }}.client.api.{{ apiName }}Api
215207
apiClass = Class.forName("com.datadog.api.client." + apiVersion + ".api." + apiName + "Api");
@@ -218,8 +210,7 @@ public void setupAPI(String apiVersion, String apiName)
218210
}
219211

220212
public void setUnstableOperationEnabled(String operationId)
221-
throws java.lang.reflect.InvocationTargetException,
222-
java.lang.IllegalAccessException,
213+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
223214
java.lang.NoSuchMethodException {
224215
// client.setUnstableOperationEnabled(operationId, true)
225216
clientClass
@@ -228,16 +219,14 @@ public void setUnstableOperationEnabled(String operationId)
228219
}
229220

230221
public void configureApiKeys(Map<String, String> secrets)
231-
throws java.lang.reflect.InvocationTargetException,
232-
java.lang.IllegalAccessException,
222+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
233223
java.lang.NoSuchMethodException {
234224
// client.configureApiKeys(secrets)
235225
clientClass.getMethod("configureApiKeys", Map.class).invoke(client, secrets);
236226
}
237227

238228
public void authenticateClient(Class<?> clientClass, Object client)
239-
throws java.lang.reflect.InvocationTargetException,
240-
java.lang.IllegalAccessException,
229+
throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException,
241230
java.lang.NoSuchMethodException {
242231

243232
HashMap<String, String> secrets = new HashMap<String, String>();
@@ -269,10 +258,8 @@ public void newRequest(String name) {
269258
}
270259

271260
public void addRequestParameter(String parameterName, String value)
272-
throws java.lang.IllegalAccessException,
273-
java.lang.NoSuchFieldException,
274-
java.lang.NoSuchMethodException,
275-
java.lang.reflect.InvocationTargetException,
261+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
262+
java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException,
276263
com.fasterxml.jackson.core.JsonProcessingException {
277264
String propertyName = toPropertyName(parameterName);
278265
Class fieldType = null;
@@ -307,10 +294,8 @@ public void addRequestParameter(String parameterName, String value)
307294
}
308295

309296
public void addRequestParameterFixture(String parameterName, String fixturePath)
310-
throws java.lang.IllegalAccessException,
311-
java.lang.NoSuchFieldException,
312-
java.lang.NoSuchMethodException,
313-
java.lang.reflect.InvocationTargetException {
297+
throws java.lang.IllegalAccessException, java.lang.NoSuchFieldException,
298+
java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException {
314299
String propertyName = toPropertyName(parameterName);
315300
Class fieldType = null;
316301
boolean isOptional = false;
@@ -586,8 +571,7 @@ public void sendPaginatedRequest() throws Exception {
586571
}
587572

588573
public ObjectMapper getObjectMapper()
589-
throws java.lang.IllegalAccessException,
590-
java.lang.NoSuchMethodException,
574+
throws java.lang.IllegalAccessException, java.lang.NoSuchMethodException,
591575
java.lang.reflect.InvocationTargetException {
592576
Method getJSON = clientClass.getMethod("getJSON");
593577
Object json = getJSON.invoke(client);

0 commit comments

Comments
 (0)