### Question:
UniqueIdCheckStep extends ReificationStep { @Override public void execute(final Dialog dialog, final Context context) throws ReificationException { IdVisitor idVisitor = new IdVisitor(); dialog.getInterfaceModel().accept(idVisitor); boolean comma = false; StringBuilder message = new StringBuilder(); Map<QName, Integer> idCount = idVisitor.getIdCount(); for (Map.Entry<QName, Integer> entry : idCount.entrySet()) { if (entry.getValue() > 1) { if (comma) { message.append(", "); } message.append(entry.getKey()).append(": ").append(entry.getValue()); comma = false; } } if (message.length() != 0) { throw new ReificationException( "The model contains interaction units with non-unique ids. The following interactions units are used more than once: " + message); } } UniqueIdCheckStep(); @Override void execute(final Dialog dialog, final Context context);  }### Answer:
@Test public void uniqueIds() { String namespace = "org.jboss.sample"; InteractionUnit root = new Builder() .start(new Container(namespace, "sample", "Sample", Choice)) .start(new Container(namespace, "tab1", "Fooo", Concurrency)) .add(new Select(namespace, "list", "List")) .end() .start(new Container(namespace, "tab2", "Bar", Concurrency)) .end() .end() .build(); Dialog dialog = new Dialog(QName.valueOf(namespace + ":sample"), root); pipeline.execute(dialog, new Context()); }
@Test public void noneUniqueIds() { String namespace = "org.jboss.sample"; InteractionUnit root = new Builder() .start(new Container(namespace, "sample", "Sample", Choice)) .start(new Container(namespace, "tab1", "Fooo", Concurrency)) .add(new Select(namespace, "list", "List1")) .end() .start(new Container(namespace, "tab2", "Bar", Concurrency)) .add(new Select(namespace, "list", "List2")) .end() .end() .build(); Dialog dialog = new Dialog(QName.valueOf(namespace + ":sample"), root); try { pipeline.execute(dialog, new Context()); fail("ReificationException expected"); } catch (ReificationException e) { String message = e.getMessage(); assertTrue(message.contains("list: 2")); } }