Merge pull request #2136 from rasahner/unitTestGroupbyHaving

for completeness, unit test for groupby/having with unrecognized type
This commit is contained in:
Fangjin Yang 2015-12-21 18:38:45 -08:00
commit e38b7554e4
1 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,19 @@ public class HavingSpecTest
assertEquals(andHavingSpec, mapper.convertValue(payloadMap, AndHavingSpec.class)); assertEquals(andHavingSpec, mapper.convertValue(payloadMap, AndHavingSpec.class));
} }
@Test(expected = IllegalArgumentException.class)
public void testTypeTypo()
{
Map<String, Object> greaterMap = ImmutableMap.<String, Object>of(
"type", "nonExistingType",
"aggregation", "agg",
"value", 1.3
);
ObjectMapper mapper = new DefaultObjectMapper();
HavingSpec spec = mapper.convertValue (greaterMap, HavingSpec.class);
}
@Test @Test
public void testGreaterThanHavingSpec() { public void testGreaterThanHavingSpec() {
GreaterThanHavingSpec spec = new GreaterThanHavingSpec("metric", Long.valueOf(Long.MAX_VALUE - 10)); GreaterThanHavingSpec spec = new GreaterThanHavingSpec("metric", Long.valueOf(Long.MAX_VALUE - 10));