GetDMNModelCommand extends AbstractDMNModelCommand { @Override public DMNModel execute(Context context) { return getDMNModel(context); } GetDMNModelCommand(String namespace, String modelName);  GetDMNModelCommand(String resourcePath); @Override DMNModel execute(Context context);  }
@Test public void execute() { String namespace = "http: String modelName = "typecheck in DT"; GetDMNModelCommand getDMNModelCommand = new GetDMNModelCommand(namespace, modelName); assertThatThrownBy(() -> getDMNModelCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNRuntime available"); registryContext.register(DMNRuntime.class, dmnRuntime); DMNModel dmnModel = getDMNModelCommand.execute(registryContext); assertEquals(namespace, dmnModel.getNamespace()); assertEquals(modelName, dmnModel.getName()); }
@Test public void executeWithResource() { GetDMNModelCommand getDMNModelCommand = new GetDMNModelCommand(resource.getSourcePath()); assertThatThrownBy(() -> getDMNModelCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNRuntime available"); registryContext.register(DMNRuntime.class, dmnRuntime); DMNModel dmnModel = getDMNModelCommand.execute(registryContext); assertEquals(resource.getSourcePath(), dmnModel.getResource().getSourcePath()); }