MagicListGlobals implements SpecialCommand { @Override public StellarResult execute(String command, StellarShellExecutor executor) { Map<String, Object> globals = executor.getGlobalConfig(); return StellarResult.success(globals.toString()); }  @Override String getCommand(); @Override Function<String, Boolean> getMatcher(); @Override StellarResult execute(String command, StellarShellExecutor executor); static final String MAGIC_GLOBALS; }
@Test public void test() { executor.getGlobalConfig().put("x", 2); StellarResult result = executor.execute("%globals"); assertTrue(result.isSuccess()); assertTrue(result.getValue().isPresent()); String out = ConversionUtils.convert(result.getValue().get(), String.class); assertEquals("{x=2}", out); }
@Test public void testWithNoGlobals() { StellarResult result = executor.execute("%globals"); assertTrue(result.isSuccess()); assertTrue(result.getValue().isPresent()); String out = ConversionUtils.convert(result.getValue().get(), String.class); assertEquals("{}", out); }