    @Test
    public void testflushIfNeeded() {

        // Make sure flush is done for whitelisted base url
        boolean flushed = Castle.flushIfNeeded("https://google.com/");

        // FlushIfNeeded returns true if url is whitelisted and flush() is called
        Assert.assertTrue(flushed);

        // Make sure flush is NOT done for non whitelisted base url
        flushed = Castle.flushIfNeeded("https://test.com");

        // FlushIfNeeded returns fasle if url is not whitelisted
        Assert.assertFalse(flushed);
    }