SetDMNInputCommand implements ExecutableCommand<Void> { @Override public Void execute(Context context) { RegistryContext registryContext = (RegistryContext) context; DMNContext dmnContext = registryContext .computeIfAbsent(DMNContext.class, clazz -> { DMNRuntime dmnRuntime = registryContext.lookup(DMNRuntime.class); return dmnRuntime != null ? dmnRuntime.newContext() : DMNFactory.newContext(); }); dmnContext.set(name, value); return null; } SetDMNInputCommand(String name, Object value); @Override Void execute(Context context);  }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); String testVariable = "testVariable"; SetDMNInputCommand setDMNInputCommand = new SetDMNInputCommand(testVariable, 10); setDMNInputCommand.execute(registryContext); DMNContext lookup = registryContext.lookup(DMNContext.class); assertTrue(lookup.isDefined(testVariable)); }