Add additional checkstyle checks

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2020-01-24 17:37:30 +11:00
parent 78e6909f8c
commit 0c53c95293
35 changed files with 227 additions and 202 deletions

View File

@@ -10,27 +10,27 @@ import org.junit.Test;
public class StringUtilTest {
@Test(expected=NullPointerException.class)
@Test(expected = NullPointerException.class)
public void nullPrefixTest() {
StringUtil.startsWithIgnoreCase("String", null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void nullStringTest() {
StringUtil.startsWithIgnoreCase(null, "String");
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void nullCollectionTest() {
StringUtil.copyPartialMatches("Token", ImmutableList.<String>of(), null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void nullIterableTest() {
StringUtil.copyPartialMatches("Token", null, new ArrayList<String>());
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void nullTokenTest() {
StringUtil.copyPartialMatches(null, ImmutableList.<String>of(), new ArrayList<String>());
}
@@ -38,20 +38,20 @@ public class StringUtilTest {
@Test
public void copyTokenTest() {
String token = "ab";
Iterable<String> original = ImmutableList.of("ab12", "aC561", "AB5195", "Ab76", "", "a");
List<String> expected = ImmutableList.of("ab12", "AB5195", "Ab76" );
List<String> original = ImmutableList.of("ab12", "aC561", "AB5195", "Ab76", "", "a");
List<String> expected = ImmutableList.of("ab12", "AB5195", "Ab76");
List<String> list = new ArrayList<String>();
assertThat(StringUtil.copyPartialMatches(token, original, list), is(expected));
assertThat(StringUtil.copyPartialMatches(token, original, list), is(sameInstance(list)));
assertThat(list.size(), is(expected.size() * 2));
}
@Test(expected=UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void copyUnsupportedTest() {
StringUtil.copyPartialMatches("token", ImmutableList.of("token1", "token2"), ImmutableList.of());
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void copyNullTest() {
StringUtil.copyPartialMatches("token", Arrays.asList("token1", "token2", null), new ArrayList<String>());
}