Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2294#discussion_r167152061
  
    --- Diff: 
nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/test/java/org/apache/nifi/hbase/MockHBaseClientService.java
 ---
    @@ -71,6 +73,43 @@ public void delete(String tableName, byte[] rowId) 
throws IOException {
             throw new UnsupportedOperationException();
         }
     
    +    @Override
    +    public void delete(String tableName, List<byte[]> rowIds) throws 
IOException {
    +        if (throwException) {
    +            throw new RuntimeException("Simulated connectivity error");
    +        }
    +
    +        Random random = new Random();
    +        int location = 0;
    +        if (rowIds.size() > 1) {
    +            while (location == 0) {
    +                location = random.nextInt(rowIds.size());
    --- End diff --
    
    Using random to simulate exception situation looks cool, but it should be 
avoided in unit testing where we want consistent behavior at every time. I 
prefer making it a parameter passed from the test method.


---

Reply via email to