HorizonNet commented on a change in pull request #541: HBASE-22886 Code 
Coverage Improvement: Create Unit Tests for class ConnectionId
URL: https://github.com/apache/hbase/pull/541#discussion_r319919550
 
 

 ##########
 File path: 
hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestConnectionId.java
 ##########
 @@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.ipc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import java.net.InetSocketAddress;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.testclassification.ClientTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({SmallTests.class, ClientTests.class})
+public class TestConnectionId {
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+          HBaseClassTestRule.forClass(TestConnectionId.class);
+
+  private Configuration testConfig = HBaseConfiguration.create();
+  private User testUser1 = User.createUserForTesting(testConfig, "test", new 
String[]{"testgroup"});
+  private User testUser2 = User.createUserForTesting(testConfig, "test", new 
String[]{"testgroup"});
+  private String serviceName = "test";
+  private InetSocketAddress address = new InetSocketAddress(999);
+  private ConnectionId connectionId1 = new ConnectionId(testUser1, 
serviceName, address);
+  private ConnectionId connectionId2 = new ConnectionId(testUser2, 
serviceName, address);
+
+  @Test
+  public void testGetServiceName() {
+    assertSame("test", connectionId1.getServiceName());
+    assertNotSame("test1", connectionId1.getServiceName());
 
 Review comment:
   I don't think that this check is necessary, because it is kind of an 
inversion of the first check.

----------------------------------------------------------------
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

Reply via email to