Small cleanups / changes amassed over time

- Small javadoc fixes
- Simplifications
- Move logException method from StringUtils to ExceptionUtils
This commit is contained in:
ljacqu
2018-04-22 12:45:34 +02:00
parent baec034909
commit ecaffbabfc
13 changed files with 44 additions and 61 deletions
@@ -4,8 +4,10 @@ import fr.xephi.authme.ReflectionTestUtils;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import java.net.MalformedURLException;
import java.util.ConcurrentModificationException;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;
@@ -58,4 +60,16 @@ public class ExceptionUtilsTest {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(ExceptionUtils.class);
}
@Test
public void shouldFormatException() {
// given
MalformedURLException ex = new MalformedURLException("Unrecognized URL format");
// when
String result = ExceptionUtils.formatException(ex);
// then
assertThat(result, equalTo("[MalformedURLException]: Unrecognized URL format"));
}
}
@@ -3,8 +3,6 @@ package fr.xephi.authme.util;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import java.net.MalformedURLException;
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
@@ -63,18 +61,6 @@ public class StringUtilsTest {
assertFalse(StringUtils.isEmpty(" test"));
}
@Test
public void shouldFormatException() {
// given
MalformedURLException ex = new MalformedURLException("Unrecognized URL format");
// when
String result = StringUtils.formatException(ex);
// then
assertThat(result, equalTo("[MalformedURLException]: Unrecognized URL format"));
}
@Test
public void shouldGetDifferenceWithNullString() {
// given/when/then