keith-turner commented on PR #51:
URL: https://github.com/apache/accumulo-access/pull/51#issuecomment-1942771697

   One nice thing about this structure is that it makes it possible to test the 
example and ensure changes to the library do not break the example and visa 
versa.  Experimented with this locally and came up with the following.
   
   ```java
   package example;
   
   import org.junit.jupiter.api.Assertions;
   import org.junit.jupiter.api.Test;
   
   import java.io.ByteArrayOutputStream;
   import java.io.PrintStream;
   import java.util.List;
   
   public class AccessExampleTest {
       @Test
       public void testExampleCode(){
           final ByteArrayOutputStream baos = new ByteArrayOutputStream();
           final PrintStream out = new PrintStream(baos);
           System.setOut(out);
           AccessExample.main(new String[]{"RED", "BLUE"});
           var output = baos.toString();
           for(var expected : List.of("data3","data5","data6","data9")) {
               Assertions.assertTrue(output.contains(expected));
           }
           for(var unexpected : List.of("data1","data4","data7","data8")) {
               Assertions.assertFalse(output.contains(unexpected));
           }
   
   
       }
   }
   
   ```


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to