@Test
  public void testMutateRow() throws Exception {
    final byte[] qual2 = Bytes.toBytes("qual2");
    TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(tableName)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(fam)).build();
    TEST_UTIL.getAdmin().createTable(tableDescriptor);
    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
      Put p1 = new Put(row1);
      p1.addColumn(fam, qual, value);
      p1.setCellVisibility(new CellVisibility(CONFIDENTIAL));

      Put p2 = new Put(row1);
      p2.addColumn(fam, qual2, value);
      p2.setCellVisibility(new CellVisibility(SECRET));

      RowMutations rm = new RowMutations(row1);
      rm.add(p1);
      rm.add(p2);

      table.mutateRow(rm);

      Get get = new Get(row1);
      get.setAuthorizations(new Authorizations(CONFIDENTIAL));
      Result result = table.get(get);
      assertTrue(result.containsColumn(fam, qual));
      assertFalse(result.containsColumn(fam, qual2));

      get.setAuthorizations(new Authorizations(SECRET));
      result = table.get(get);
      assertFalse(result.containsColumn(fam, qual));
      assertTrue(result.containsColumn(fam, qual2));
    }
  }
Base test class for visibility labels basic features
hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java