Search in sources :

Example 1 with BaseURLBridgeURIAdapterImpl

use of com.liferay.faces.bridge.internal.BaseURLBridgeURIAdapterImpl in project liferay-faces-bridge-impl by liferay.

the class BridgeURITest method testXmlEscaping.

@Test
public void testXmlEscaping() throws UnsupportedEncodingException {
    try {
        BridgeURI bridgeURI = newBridgeURI("http://www.liferay.com/hello.world?a=1&b=2");
        BaseURL nonEncodedURL = new BaseURLBridgeURIAdapterImpl(bridgeURI);
        Writer stringWriter = new StringWriter();
        nonEncodedURL.write(stringWriter, false);
        Assert.assertTrue("http://www.liferay.com/hello.world?a=1&b=2".equals(stringWriter.toString()));
        stringWriter = new StringWriter();
        nonEncodedURL.write(stringWriter, true);
        Assert.assertTrue("http://www.liferay.com/hello.world?a=1&b=2".equals(stringWriter.toString()));
    } catch (IOException e) {
        throw new AssertionError(e);
    } catch (URISyntaxException e) {
        throw new AssertionError(e);
    }
}
Also used : StringWriter(java.io.StringWriter) BaseURLBridgeURIAdapterImpl(com.liferay.faces.bridge.internal.BaseURLBridgeURIAdapterImpl) BridgeURI(com.liferay.faces.bridge.internal.BridgeURI) BaseURL(javax.portlet.BaseURL) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) StringWriter(java.io.StringWriter) Writer(java.io.Writer) Test(org.junit.Test)

Aggregations

BaseURLBridgeURIAdapterImpl (com.liferay.faces.bridge.internal.BaseURLBridgeURIAdapterImpl)1 BridgeURI (com.liferay.faces.bridge.internal.BridgeURI)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 URISyntaxException (java.net.URISyntaxException)1 BaseURL (javax.portlet.BaseURL)1 Test (org.junit.Test)1