Search in sources :

Example 1 with Console

use of org.apache.knox.test.Console in project knox by apache.

the class XmlGatewayDescriptorExporterTest method testXmlGatewayDescriptorStoreFailure.

@Test
public void testXmlGatewayDescriptorStoreFailure() throws IOException {
    GatewayDescriptor descriptor = GatewayDescriptorFactory.create().addResource().addFilter().param().up().up().up();
    Console console = new Console();
    try {
        console.capture();
        GatewayDescriptorFactory.store(descriptor, "xml", new BrokenWriter());
        fail("Expected IOException");
    } catch (IOException e) {
        assertThat(e.getMessage(), containsString("BROKEN"));
    } finally {
        console.release();
    }
}
Also used : GatewayDescriptor(org.apache.knox.gateway.descriptor.GatewayDescriptor) Console(org.apache.knox.test.Console) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 GatewayDescriptor (org.apache.knox.gateway.descriptor.GatewayDescriptor)1 Console (org.apache.knox.test.Console)1 Test (org.junit.Test)1