OptionalContext extends CommandContext<T> { public <V> @Nullable V getOptionalArgument(String name, Class<V> type) { return getOptionalArgument(name, type, null); } OptionalContext(CommandContext<T> context); V getOptionalArgument(String name, Class<V> type); V getOptionalArgument(String name, Class<V> type, V value); @Override OptionalContext<T> copyFor(T source); @Override CommandContext<T> getChild(); @Override CommandContext<T> getLastChild(); @Override Command<T> getCommand(); @Override T getSource(); @Override V getArgument(String name, Class<V> type); @Override RedirectModifier<T> getRedirectModifier(); @Override StringRange getRange(); @Override String getInput(); @Override List<ParsedCommandNode<T>> getNodes(); @Override boolean isForked(); @Override boolean equals(Object other); @Override int hashCode();  }
@Test void getOptionalArgument() { assertEquals("value", CONTEXT.getOptionalArgument("argument", String.class)); }
@Test void getOptionalArgument_null() { assertNull(CONTEXT.getOptionalArgument("invalid", String.class)); }
@Test void getOptionalArgument_default() { assertEquals("value", CONTEXT.getOptionalArgument("argument", String.class, "value")); }
@Test void getOptionalArgument_default_default() { assertEquals("default", CONTEXT.getOptionalArgument("invalid", String.class, "default")); }