1 package org.simantics.modeling.tests.commands;
5 import junit.framework.Assert;
7 import org.simantics.db.Resource;
8 import org.simantics.db.WriteGraph;
9 import org.simantics.db.exception.DatabaseException;
10 import org.simantics.db.layer0.variable.Variable;
11 import org.simantics.db.testing.common.WriteCommand;
12 import org.simantics.issues.common.IssuesWithContext;
13 import org.simantics.modeling.ModelingResources;
14 import org.simantics.modeling.tests.cases.ModelingCommandSequenceTest;
17 public class AssertIssueCount extends WriteCommand<ModelingCommandSequenceTest> {
19 private AddModule module;
22 public AssertIssueCount(AddModule module, int expected) {
24 this.expected = expected;
28 protected void run(WriteGraph graph, ModelingCommandSequenceTest environment) throws DatabaseException {
30 Resource element = module.getResource();
31 Resource component = graph.getSingleObject(element, ModelingResources.getInstance(graph).ElementToComponent);
32 Set<Variable> issues = graph.sync(new IssuesWithContext(graph, component));
34 Assert.assertEquals(expected, issues.size());