@Override
        public Void run() throws Exception {
          try (Connection connection = ConnectionFactory.createConnection(conf);
            Table table = connection.getTable(tableName)) {
            Put p = new Put(row1);
            p.setCellVisibility(new CellVisibility(PUBLIC + "&" + TOPSECRET));
            p.addColumn(fam, qual, 125L, value);
            table.put(p);
            Assert.fail("Testcase should fail with AccesDeniedException");
          } catch (Throwable t) {
            assertTrue(t.getMessage().contains("AccessDeniedException"));
          }
          return null;
        }
Test visibility by setting 'hbase.security.visibility.mutations.checkauths' to true
hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java