コード例 #1
0
 @Override
 public final Set<String> getArgumentMatches(CommandContext commandContext) {
   int lastArgumentIndex = commandContext.size() - 1;
   if (commandContext.size() < lastArgumentIndex || commandContext.size() == 0)
     return Collections.EMPTY_SET;
   if (commandContext.size() < lastArgumentIndex || getMatchers().isEmpty())
     return Collections.EMPTY_SET;
   return getMatchers()
       .get(lastArgumentIndex)
       .matches(commandContext.getString(lastArgumentIndex));
 }
コード例 #2
0
 private void configureCommandContext(CommandContext commandContext) {
   when(commandContext.size()).thenReturn(1);
   when(commandContext.has(anyInt())).thenReturn(true);
   when(commandContext.getString(anyInt())).thenReturn("test");
 }