@Test
public void relationshipTemplateIsSerializedAsRefInXml() throws Exception {

    TTopologyTemplate minimalTopologyTemplate = new TTopologyTemplate();
    TNodeTemplate nt1 = new TNodeTemplate("nt1");
    minimalTopologyTemplate.addNodeTemplate(nt1);
    TNodeTemplate nt2 = new TNodeTemplate("nt2");
    minimalTopologyTemplate.addNodeTemplate(nt2);
    TRelationshipTemplate rt = new TRelationshipTemplate("rt");
    minimalTopologyTemplate.addRelationshipTemplate(rt);
    rt.setSourceNodeTemplate(nt1);
    rt.setTargetNodeTemplate(nt2);
    String minimalTopologyTemplateAsXmlString = "" +
        "<TopologyTemplate xmlns=\"http://docs.oasis-open.org/tosca/ns/2011/12\" " +
        "                  xmlns:ns3=\"http://www.eclipse.org/winery/model/selfservice\" " +
        "                  xmlns:ns4=\"http://test.winery.opentosca.org\" " +
        "                  xmlns:winery=\"http://www.opentosca.org/winery/extensions/tosca/2013/02/12\">\n" +
        "  <NodeTemplate id=\"nt1\"/>\n" +
        "  <NodeTemplate id=\"nt2\"/>\n" +
        "  <RelationshipTemplate id=\"rt\">\n" +
        "    <SourceElement ref=\"nt1\"/>\n" +
        "    <TargetElement ref=\"nt2\"/>\n" +
        "  </RelationshipTemplate>\n" +
        "</TopologyTemplate>";
    org.hamcrest.MatcherAssert.assertThat(BackendUtils.getXMLAsString(minimalTopologyTemplate), CompareMatcher.isIdenticalTo(minimalTopologyTemplateAsXmlString).ignoreWhitespace());
}