Move the time parsing tests into the util tests, as that's what it
really is testing.
This commit is contained in:
parent
b5b79b9704
commit
4829a75785
@ -1,43 +0,0 @@
|
||||
package test.java.com.graywolf336.jail;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.graywolf336.jail.Util;
|
||||
|
||||
public class TestTimeParsing {
|
||||
|
||||
@Test
|
||||
public void testNoFormat() throws Exception {
|
||||
assertThat(60000L, is(Util.getTime("1")));
|
||||
assertThat(360000L, is(Util.getTime("6")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeconds() throws Exception {
|
||||
assertThat(2000L, is(Util.getTime("2s")));
|
||||
assertThat(2000L, is(Util.getTime("2second")));
|
||||
assertThat(2000L, is(Util.getTime("2seconds")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutes() throws Exception {
|
||||
assertThat(60000L, is(Util.getTime("1m")));
|
||||
assertThat(60000L, is(Util.getTime("1minute")));
|
||||
assertThat(60000L, is(Util.getTime("1minutes")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHours() throws Exception {
|
||||
assertThat(3600000L, is(Util.getTime("1h")));
|
||||
assertThat(3600000L, is(Util.getTime("1hours")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDays() throws Exception {
|
||||
assertThat(86400000L, is(Util.getTime("1d")));
|
||||
assertThat(86400000L, is(Util.getTime("1days")));
|
||||
}
|
||||
}
|
@ -66,4 +66,36 @@ public class TestUtilClass {
|
||||
assertFalse(Util.isStringInsideList(list, "SAND"));
|
||||
assertFalse(Util.isStringInsideList(list, Material.BEDROCK.toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoFormat() throws Exception {
|
||||
assertEquals(60000L, Util.getTime("1"), 0);
|
||||
assertEquals(360000L, Util.getTime("6"), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeconds() throws Exception {
|
||||
assertEquals(2000L, Util.getTime("2s"), 0);
|
||||
assertEquals(2000L, Util.getTime("2second"), 0);
|
||||
assertEquals(2000L, Util.getTime("2seconds"), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutes() throws Exception {
|
||||
assertEquals(60000L, Util.getTime("1m"), 0);
|
||||
assertEquals(60000L, Util.getTime("1minute"), 0);
|
||||
assertEquals(60000L, Util.getTime("1minutes"), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHours() throws Exception {
|
||||
assertEquals(3600000L, Util.getTime("1h"), 0);
|
||||
assertEquals(3600000L, Util.getTime("1hours"), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDays() throws Exception {
|
||||
assertEquals(86400000L, Util.getTime("1d"), 0);
|
||||
assertEquals(86400000L, Util.getTime("1days"), 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user