1313import com .gooddata .sdk .model .md .visualization .VisualizationClass ;
1414import com .gooddata .sdk .model .project .Project ;
1515import com .gooddata .sdk .service .GoodDataSettings ;
16- import org .mockito .Matchers ;
1716import org .mockito .Mock ;
1817import org .mockito .MockitoAnnotations ;
1918import org .springframework .http .HttpStatus ;
2928import static com .gooddata .sdk .common .util .ResourceUtils .readObjectFromResource ;
3029import static java .lang .String .format ;
3130import static java .util .Arrays .asList ;
31+ import static java .util .Collections .singletonList ;
3232import static org .hamcrest .CoreMatchers .*;
3333import static org .hamcrest .MatcherAssert .assertThat ;
3434import static org .hamcrest .collection .IsCollectionWithSize .hasSize ;
@@ -61,7 +61,6 @@ public void testCreateObjNullResponse() {
6161 }
6262
6363 @ Test (expectedExceptions = ObjCreateException .class )
64- @ SuppressWarnings ("unchecked" )
6564 public void testCreateObjGDRestException () {
6665 final Obj obj = mock (Obj .class );
6766 when (restTemplate .postForObject (Obj .URI , obj , UriResponse .class , PROJECT_ID ))
@@ -82,7 +81,7 @@ public void testCreateObj() {
8281 final Obj obj = mock (Obj .class );
8382 final Obj resultObj = mock (Obj .class );
8483
85- when (restTemplate .postForObject (eq (Obj .CREATE_WITH_ID_URI ), eq (obj ), Matchers .< Class < Obj >> any (), eq (PROJECT_ID )))
84+ when (restTemplate .postForObject (eq (Obj .CREATE_WITH_ID_URI ), eq (obj ), any (), eq (PROJECT_ID )))
8685 .thenReturn (resultObj );
8786
8887 final Obj result = service .createObj (project , obj );
@@ -139,7 +138,7 @@ public void testGetObjsByUrisNullUris() {
139138
140139 @ Test
141140 public void testGetObjsByUris () {
142- final BulkGetUris request = new BulkGetUris (Collections . singletonList (URI ));
141+ final BulkGetUris request = new BulkGetUris (singletonList (URI ));
143142 final BulkGet response = readObjectFromResource ("/md/bulk-get.json" , BulkGet .class );
144143 when (restTemplate .postForObject (BulkGet .URI , request , BulkGet .class , PROJECT_ID )).thenReturn (response );
145144
@@ -149,14 +148,14 @@ public void testGetObjsByUris() {
149148
150149 @ Test (expectedExceptions = GoodDataException .class )
151150 public void testGetObjsByUrisWithClientSideHTTPError () {
152- final BulkGetUris request = new BulkGetUris (Collections . singletonList ("" ));
151+ final BulkGetUris request = new BulkGetUris (singletonList ("" ));
153152 when (restTemplate .postForObject (BulkGet .URI , request , BulkGet .class , PROJECT_ID )).thenThrow (new RestClientException ("" ));
154153 service .getObjsByUris (project , request .getItems ());
155154 }
156155
157156 @ Test (expectedExceptions = GoodDataRestException .class )
158157 public void testGetObjsByUrisWithServerSideHTTPError () {
159- final BulkGetUris request = new BulkGetUris (Collections . singletonList ("" ));
158+ final BulkGetUris request = new BulkGetUris (singletonList ("" ));
160159 when (restTemplate .postForObject (BulkGet .URI , request , BulkGet .class , PROJECT_ID )).thenThrow (new GoodDataRestException (500 , "" , "" , "" , "" ));
161160 service .getObjsByUris (project , request .getItems ());
162161 }
@@ -273,7 +272,7 @@ public void testGetObjUriToFindOneObjByTitle() {
273272 final String uri = "myURI" ;
274273 final String title = "myTitle" ;
275274 when (restTemplate .getForObject (Query .URI , Query .class , project .getId (), "queryables" )).thenReturn (queryResult );
276- when (queryResult .getEntries ()).thenReturn (asList (resultEntry ));
275+ when (queryResult .getEntries ()).thenReturn (singletonList (resultEntry ));
277276 when (resultEntry .getTitle ()).thenReturn (title );
278277 when (resultEntry .getUri ()).thenReturn (uri );
279278
@@ -298,7 +297,7 @@ public void testGetObjUriNothingFound() {
298297 final Entry resultEntry = mock (Entry .class );
299298 final String title = "myTitle" ;
300299 when (restTemplate .getForObject (Query .URI , Query .class , project .getId (), "queryables" )).thenReturn (queryResult );
301- when (queryResult .getEntries ()).thenReturn (asList (resultEntry ));
300+ when (queryResult .getEntries ()).thenReturn (singletonList (resultEntry ));
302301
303302 service .getObjUri (project , Queryable .class , Restriction .title (title ));
304303 }
@@ -311,7 +310,7 @@ public void testGetObjToFindOneObjById() {
311310 final String uri = "myURI" ;
312311 final String id = "myId" ;
313312 when (restTemplate .getForObject (Query .URI , Query .class , project .getId (), "queryables" )).thenReturn (queryResult );
314- when (queryResult .getEntries ()).thenReturn (asList (resultEntry ));
313+ when (queryResult .getEntries ()).thenReturn (singletonList (resultEntry ));
315314 when (resultEntry .getIdentifier ()).thenReturn (id );
316315 when (resultEntry .getUri ()).thenReturn (uri );
317316 when (restTemplate .getForObject (uri , Queryable .class )).thenReturn (intendedResult );
@@ -337,7 +336,7 @@ public void testGetObjNothingFound() {
337336 final Entry resultEntry = mock (Entry .class );
338337 final String title = "myTitle" ;
339338 when (restTemplate .getForObject (Query .URI , Query .class , project .getId (), "queryables" )).thenReturn (queryResult );
340- when (queryResult .getEntries ()).thenReturn (asList (resultEntry ));
339+ when (queryResult .getEntries ()).thenReturn (singletonList (resultEntry ));
341340
342341 service .getObj (project , Queryable .class , Restriction .title (title ));
343342 }
0 commit comments