-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed @autocomplete with List<String> returning value not applying result
- Loading branch information
1 parent
068f38f
commit 5b55cf3
Showing
2 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/skywolf46/commandannotation/test/CompleterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package skywolf46.commandannotation.test; | ||
|
||
import org.junit.Test; | ||
import skywolf46.commandannotation.annotations.autocomplete.AutoComplete; | ||
import skywolf46.commandannotation.data.autocomplete.AutoCompleteSupplier; | ||
import skywolf46.commandannotation.data.methodprocessor.ClassData; | ||
import skywolf46.commandannotation.data.methodprocessor.GlobalData; | ||
import skywolf46.commandannotation.data.methodprocessor.MethodChain; | ||
import skywolf46.commandannotation.util.ParameterMatchedInvoker; | ||
import skywolf46.commandannotation.util.ParameterStorage; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class CompleterTest { | ||
|
||
@Test | ||
public void completerTest() { | ||
try { | ||
AutoCompleteSupplier asp = AutoCompleteSupplier.from(new MethodChain(new ClassData(getClass(), new GlobalData()), new ParameterMatchedInvoker(getClass().getMethod("test"), null))); | ||
List<String> test = new ArrayList<>(); | ||
asp.editCompletion(new ParameterStorage(), test); | ||
System.out.println(test); | ||
assertEquals(new ArrayList<>(Arrays.asList("Test1", "Test2")), test); | ||
} catch (NoSuchMethodException e) { | ||
e.printStackTrace(); | ||
} catch (Throwable throwable) { | ||
throwable.printStackTrace(); | ||
} | ||
} | ||
|
||
@AutoComplete | ||
public static List<String> test() { | ||
System.out.println("Test"); | ||
return new ArrayList<>(Arrays.asList("Test1", "Test2")); | ||
} | ||
} |