Log missing Vault/economy plugin during parsing of money things.
Changes the "Vault was not found" message in Vault setup to INFO instead of WARNING, because this configuration isn't actually necessarily a warning sign. Parsing a money thing with no economy is, however. MoneyThingParser logs at ERROR level if Vault or an economy plugin isn't found, but a money thing is parsed.
This commit is contained in:
@@ -4,7 +4,9 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
@@ -14,16 +16,19 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MoneyThingParserTest {
|
||||
|
||||
private MoneyThingParser subject;
|
||||
private MobArena plugin;
|
||||
|
||||
@Rule
|
||||
public ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MobArena plugin = mock(MobArena.class);
|
||||
plugin = mock(MobArena.class);
|
||||
Economy economy = mock(Economy.class);
|
||||
when(plugin.getEconomy()).thenReturn(economy);
|
||||
|
||||
@@ -51,6 +56,17 @@ public class MoneyThingParserTest {
|
||||
assertThat(result, not(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullEconomyNullMoney() {
|
||||
Logger logger = mock(Logger.class);
|
||||
when(plugin.getEconomy()).thenReturn(null);
|
||||
when(plugin.getLogger()).thenReturn(logger);
|
||||
|
||||
subject.parse("$500");
|
||||
|
||||
verify(logger).severe(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void numberFormatForNaughtyValues() {
|
||||
exception.expect(NumberFormatException.class);
|
||||
|
||||
Reference in New Issue
Block a user