Skip to content

Commit 3f292e0

Browse files
committed
Cleanup MetadataServiceIT
1 parent 578be2b commit 3f292e0

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

gooddata-java/src/test/java/com/gooddata/sdk/service/md/MetadataServiceIT.java

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
package com.gooddata.sdk.service.md;
77

88
import com.gooddata.sdk.common.GoodDataException;
9-
import com.gooddata.sdk.service.AbstractGoodDataIT;
109
import com.gooddata.sdk.model.gdc.UriResponse;
1110
import com.gooddata.sdk.model.md.*;
1211
import com.gooddata.sdk.model.md.report.ReportDefinition;
1312
import com.gooddata.sdk.model.project.Project;
13+
import com.gooddata.sdk.service.AbstractGoodDataIT;
1414
import org.hamcrest.Matchers;
1515
import org.testng.annotations.BeforeClass;
1616
import org.testng.annotations.Test;
1717

18-
import java.io.IOException;
1918
import java.util.*;
2019

2120
import static com.gooddata.sdk.common.util.ResourceUtils.OBJECT_MAPPER;
@@ -68,14 +67,15 @@ public void testUsedBy() throws Exception {
6867
.readValue(format("{\"useMany\":[{\"uri\":\"%s\", \"entries\":[{\"title\":\"%s\"}]}]}", OBJ_URI, TITLE),
6968
UseMany.class);
7069

71-
onRequest()
70+
onRequest()
7271
.havingMethodEqualTo("POST")
7372
.havingPathEqualTo(USEDBY_URI)
74-
.respond()
73+
.respond()
7574
.withStatus(200)
7675
.withBody(OBJECT_MAPPER.writeValueAsString(useMany));
7776

78-
final Collection<Entry> result = gd.getMetadataService().usedBy(project, OBJ_URI, false, ReportDefinition.class);
77+
final Collection<Entry> result = gd.getMetadataService()
78+
.usedBy(project, OBJ_URI, false, ReportDefinition.class);
7979

8080
assertThat(result, hasSize(1));
8181
assertThat(result.iterator().next().getTitle(), is(TITLE));
@@ -87,7 +87,7 @@ public void testGetObjsByUris() {
8787
.havingMethodEqualTo("POST")
8888
.havingPathEqualTo(BULK_GET_URI)
8989
.havingBody(allOf(containsString(DATASET_URL), containsString(FACT_URL), containsString(METRIC_URL)))
90-
.respond()
90+
.respond()
9191
.withStatus(200)
9292
.withBody(readFromResource("/md/bulk-get.json"));
9393

@@ -135,11 +135,12 @@ public void testUsedByBatch() throws Exception {
135135
onRequest()
136136
.havingMethodEqualTo("POST")
137137
.havingPathEqualTo(USEDBY_URI)
138-
.respond()
138+
.respond()
139139
.withStatus(200)
140140
.withBody(OBJECT_MAPPER.writeValueAsString(useMany));
141141

142-
final Collection<Usage> result = gd.getMetadataService().usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class);
142+
final Collection<Usage> result = gd.getMetadataService()
143+
.usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class);
143144

144145
assertThat(result, hasSize(2));
145146
final Iterator<Usage> usages = result.iterator();
@@ -156,12 +157,12 @@ public void testUsedByBatch() throws Exception {
156157
}
157158

158159
@Test
159-
public void testFindIdentifierUris() throws IOException {
160+
public void testFindIdentifierUris() {
160161
onRequest()
161162
.havingMethodEqualTo("POST")
162163
.havingPathEqualTo(IDENTIFIERS_URI)
163164
.havingBody(jsonEquals(readStringFromResource("/md/identifierToUri.json")))
164-
.respond()
165+
.respond()
165166
.withStatus(200)
166167
.withBody(readFromResource("/md/identifiersAndUris.json"));
167168

@@ -171,12 +172,12 @@ public void testFindIdentifierUris() throws IOException {
171172
}
172173

173174
@Test
174-
public void testIdentifiersToUris() throws IOException {
175+
public void testIdentifiersToUris() {
175176
onRequest()
176177
.havingMethodEqualTo("POST")
177178
.havingPathEqualTo(IDENTIFIERS_URI)
178179
.havingBody(jsonEquals(readStringFromResource("/md/identifierToUri.json")))
179-
.respond()
180+
.respond()
180181
.withStatus(200)
181182
.withBody(readFromResource("/md/identifiersAndUris.json"));
182183

@@ -186,7 +187,7 @@ public void testIdentifiersToUris() throws IOException {
186187
}
187188

188189
@Test
189-
public void shouldCreateObj() throws Exception {
190+
public void shouldCreateObj() {
190191
onRequest()
191192
.havingMethodEqualTo("POST")
192193
.havingPathEqualTo(OBJ_URI)
@@ -229,34 +230,34 @@ public void shouldUpdateObj() throws Exception {
229230
}
230231

231232
@Test
232-
public void shouldRemoveObjByUri() throws Exception {
233+
public void shouldRemoveObjByUri() {
233234
onRequest()
234235
.havingMethodEqualTo("DELETE")
235236
.havingPathEqualTo(SPECIFIC_OBJ_URI)
236-
.respond()
237+
.respond()
237238
.withStatus(204);
238239

239240
gd.getMetadataService().removeObjByUri(SPECIFIC_OBJ_URI);
240241
}
241242

242243
@Test
243-
public void shouldRemoveObj() throws Exception {
244+
public void shouldRemoveObj() {
244245
onRequest()
245246
.havingMethodEqualTo("DELETE")
246247
.havingPathEqualTo(SPECIFIC_OBJ_URI)
247-
.respond()
248+
.respond()
248249
.withStatus(204);
249250

250251
gd.getMetadataService().removeObj(metricInput);
251252
}
252253

253254
@Test
254-
public void shouldCreateMailScheduleObj() throws Exception {
255+
public void shouldCreateMailScheduleObj() {
255256
onRequest()
256257
.havingMethodEqualTo("POST")
257258
.havingPathEqualTo(OBJ_URI)
258259
.havingParameterEqualTo("createAndGet", "true")
259-
.respond()
260+
.respond()
260261
.withStatus(200)
261262
.withBody(readFromResource("/md/scheduledMail.json"));
262263

@@ -269,7 +270,7 @@ public void shouldCreateMailScheduleObj() throws Exception {
269270
}
270271

271272
@Test
272-
public void shouldGetObjByUri() throws Exception {
273+
public void shouldGetObjByUri() {
273274
onRequest()
274275
.havingMethodEqualTo("GET")
275276
.havingPathEqualTo(SPECIFIC_OBJ_URI)
@@ -286,7 +287,7 @@ public void shouldGetObjByUri() throws Exception {
286287
}
287288

288289
@Test
289-
public void shouldGetObjById() throws Exception {
290+
public void shouldGetObjById() {
290291
onRequest()
291292
.havingMethodEqualTo("GET")
292293
.havingPathEqualTo(SPECIFIC_OBJ_URI)
@@ -304,7 +305,7 @@ public void shouldGetObjById() throws Exception {
304305
}
305306

306307
@Test
307-
public void shouldGetObjUriByRestrictions() throws Exception {
308+
public void shouldGetObjUriByRestrictions() {
308309
onRequest()
309310
.havingMethodEqualTo("GET")
310311
.havingPathEqualTo("/gdc/md/PROJECT_ID/query/attributes")
@@ -319,7 +320,7 @@ public void shouldGetObjUriByRestrictions() throws Exception {
319320
}
320321

321322
@Test
322-
public void shouldGetObjByRestrictions() throws Exception {
323+
public void shouldGetObjByRestrictions() {
323324
onRequest()
324325
.havingMethodEqualTo("GET")
325326
.havingPathEqualTo("/gdc/md/PROJECT_ID/query/attributes")
@@ -342,7 +343,7 @@ public void shouldGetObjByRestrictions() throws Exception {
342343
}
343344

344345
@Test
345-
public void shouldFindByRestrictions() throws Exception {
346+
public void shouldFindByRestrictions() {
346347
onRequest()
347348
.havingMethodEqualTo("GET")
348349
.havingPathEqualTo("/gdc/md/PROJECT_ID/query/attributes")
@@ -358,7 +359,7 @@ public void shouldFindByRestrictions() throws Exception {
358359
}
359360

360361
@Test
361-
public void shouldFindUrisByRestrictions() throws Exception {
362+
public void shouldFindUrisByRestrictions() {
362363
onRequest()
363364
.havingMethodEqualTo("GET")
364365
.havingPathEqualTo("/gdc/md/PROJECT_ID/query/attributes")
@@ -375,7 +376,7 @@ public void shouldFindUrisByRestrictions() throws Exception {
375376
}
376377

377378
@Test
378-
public void shouldGetAttributeElements() throws Exception {
379+
public void shouldGetAttributeElements() {
379380
onRequest()
380381
.havingMethodEqualTo("GET")
381382
.havingPathEqualTo("/gdc/md/PROJECT_ID/obj/DF_ID/elements")

0 commit comments

Comments
 (0)