add a few more tests
This commit is contained in:
parent
3997ed012b
commit
75d9445323
|
@ -104,4 +104,19 @@ public class ByteSizeValueTests extends ElasticsearchTestCase {
|
|||
public void testFailOnEmptyNumberParsing() {
|
||||
assertThat(ByteSizeValue.parseBytesSizeValue("g", "emptyNumberParsing").toString(), is("23b"));
|
||||
}
|
||||
|
||||
public void testSpaceAllowed() {
|
||||
ByteSizeValue result = ByteSizeValue.parseBytesSizeValue("42 gb", "test");
|
||||
assertEquals(42L*1024*1024*1024, result.bytes());
|
||||
}
|
||||
|
||||
@Test(expected = ElasticsearchParseException.class)
|
||||
public void testNoDotsAllowed() {
|
||||
ByteSizeValue.parseBytesSizeValue("42b.", null, "test");
|
||||
}
|
||||
|
||||
public void testCapsAllowed() {
|
||||
ByteSizeValue result = ByteSizeValue.parseBytesSizeValue("42B", null, "test");
|
||||
assertEquals(42, result.bytes());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,4 +97,19 @@ public class TimeValueTests extends ElasticsearchTestCase {
|
|||
public void testFailOnMissingUnits() {
|
||||
TimeValue.parseTimeValue("42", null, "test");
|
||||
}
|
||||
|
||||
public void testSpaceAllowed() {
|
||||
TimeValue result = TimeValue.parseTimeValue("42 ms", null, "test");
|
||||
assertEquals(42, result.millis());
|
||||
}
|
||||
|
||||
@Test(expected = ElasticsearchParseException.class)
|
||||
public void testNoDotsAllowed() {
|
||||
TimeValue.parseTimeValue("42ms.", null, "test");
|
||||
}
|
||||
|
||||
@Test(expected = ElasticsearchParseException.class)
|
||||
public void testNoCapsAllowed() {
|
||||
TimeValue.parseTimeValue("42MS", null, "test");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue