Code example for ByteArrayOutputStream

0
 
    private static ByteArrayOutputStream cliOut;
 
    @BeforeClass 
    public static void setup() throws Exception { 
        cliOut = new ByteArrayOutputStream();
    } 
 
    @AfterClass 
    public static void tearDown() throws Exception { 
        cliOut = null;
    } 
 
    @Test 
    public void testMain() throws Exception { 
        final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
        try { 
            ctx.connectController();
            ctx.handle(this.getAddPropertyReq("\"true\""));
            assertEquals("false", runIf(ctx));