sashidhar commented on a change in pull request #7933: #7858 Throwing 
UnsupportedOperationException from ImmutableDruidDataSource's equals() and 
hashCode() methods
URL: https://github.com/apache/incubator-druid/pull/7933#discussion_r302680587
 
 

 ##########
 File path: 
server/src/test/java/org/apache/druid/server/http/DataSourcesResourceTest.java
 ##########
 @@ -182,9 +182,9 @@ public void testGetFullQueryableDataSources()
     Set<ImmutableDruidDataSource> result = (Set<ImmutableDruidDataSource>) 
response.getEntity();
     Assert.assertEquals(200, response.getStatus());
     Assert.assertEquals(2, result.size());
-    Assert.assertEquals(
-        
listDataSources.stream().map(DruidDataSource::toImmutableDruidDataSource).collect(Collectors.toSet()),
-        new HashSet<>(result)
+    TestUtils.assertEqualsImmutableDruidDataSource(
+        
listDataSources.stream().map(DruidDataSource::toImmutableDruidDataSource).collect(Collectors.toList()),
 
 Review comment:
   Fixed. 
ImmutableDruidDataSourceTestUtils.assertEqualsImmutableDruidDataSource(List<>, 
List<> ) takes care of this.  Direct sort() methods on ImmutableDruidDataSource 
collection cannot be used as equals() and hashCode() methods are made as 
unsupported operations. Instead the two lists are compared in O(n^2). This 
should be fine I think for these test cases as the size of the lists is not 
greater than 2.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to