@Test
public void replaceExpression() throws SocketException, UnknownHostException {

    String host = NetworkUtil.getLocalAddress().getHostName();
    String ip = NetworkUtil.getLocalAddress().getHostAddress();
    System.getProperties().setProperty("test.prop", "testy");
    System.getProperties().setProperty("test2:prop", "testx");
    String[] testData = {
            "$host",host,
            "bla ${host} blub","bla " + host + " blub",
            "$ip$host",ip + host,
            "${ ip     }",ip,
            "|${prop:test.prop}|","|testy|",
            "${prop:test2:prop}","testx"
    };
    for (int i = 0; i < testData.length; i+=2) {
        assertEquals(NetworkUtil.replaceExpression(testData[i]),testData[i+1],"Checking " + testData[i]);
    }
}