This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CommandHelper#getRawCommand() misbehaving with sub-commands (Fixes …
…#9), Add corresponding test to prevent this from happening again
- Loading branch information
1 parent
b891cd1
commit cc1dc2f
Showing
4 changed files
with
35 additions
and
1 deletion.
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
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
24 changes: 24 additions & 0 deletions
24
common/src/test/java/io/github/xxyy/cmdblocker/common/util/CommandHelperTest.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,24 @@ | ||
package io.github.xxyy.cmdblocker.common.util; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
/** | ||
* Tests the CommandHelper class for compliance with the JavaDoc declarations | ||
* | ||
* @author <a href="http://xxyy.github.io/">xxyy</a> | ||
* @since 20/09/14 | ||
*/ | ||
public class CommandHelperTest { | ||
@Test | ||
public void testGetRawCommand() { | ||
assertThat(CommandHelper.getRawCommand("/help"), is("help")); | ||
assertThat(CommandHelper.getRawCommand("/help test"), is("help")); | ||
assertThat(CommandHelper.getRawCommand("/minecraft:help"), is("help")); | ||
assertThat(CommandHelper.getRawCommand("/minecraft:help test"), is("help")); | ||
assertThat(CommandHelper.getRawCommand("/bukkit:help"), is("help")); | ||
assertThat(CommandHelper.getRawCommand("/bukkit:help something multiple arguments wow"), is("help")); | ||
} | ||
} |
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