Promise<Object> (final @NotNull PlaybackContext context) { String text = getText().substring(PREFIX.length()).trim(); final Map<String, String> expected = new LinkedHashMap<>(); if (text.length() > 0) { final String[] keyValue = text.split(","); for (String each : keyValue) { final String[] eachPair = each.split("="); if (eachPair.length != 2) { String error = "Syntax error, must be comma-separated pairs key=value"; context.error(error, getLine()); return Promises.rejectedPromise(error); } expected.put(eachPair[0], eachPair[1]); } } final AsyncPromise<Object> result = new AsyncPromise<>(); IdeFocusManager.findInstance().doWhenFocusSettlesDown(() -> { try { doAssert(expected, context); result.setResult(null); } catch (AssertionError error) { context.error("Assertion failed: " + error.getMessage(), getLine()); result.setError(error); } }); return result; }