private void doAssertTestDefintion(final String resourceName, final ObjectMapper mapper) throws IOException {
final InputStream input = getClass().getResourceAsStream(resourceName);
Assert.assertNotNull("Input stream for " + resourceName + " should not be null", input);
try {
final TestDefinition definition = mapper.readValue(input, TestDefinition.class);
Assert.assertEquals("1", definition.getVersion());
Assert.assertEquals(TestType.ANONYMOUS_USER, definition.getTestType());
Assert.assertEquals("exampletst", definition.getSalt());
Assert.assertEquals("loggedIn", definition.getRule());
Assert.assertTrue(definition.getDescription().startsWith("An example test"));
Assert.assertEquals(0, definition.getSpecialConstants().size());
Assert.assertEquals(1, definition.getConstants().size());
Assert.assertEquals("en", definition.getConstants().get("ENGLISH"));
Assert.assertEquals(2, definition.getBuckets().size());
final TestBucket controlBucket = definition.getBuckets().get(0);
Assert.assertEquals("control", controlBucket.getName());
Assert.assertEquals(0, controlBucket.getValue());
Assert.assertNull(controlBucket.getDescription());
final TestBucket testBucket = definition.getBuckets().get(1);
Assert.assertEquals("test", testBucket.getName());
Assert.assertEquals(1, testBucket.getValue());
Assert.assertNull(testBucket.getDescription());
Assert.assertEquals(2, definition.getAllocations().size());
final Allocation englishAllocation = definition.getAllocations().get(0);
Assert.assertEquals("${lang == ENGLISH}", englishAllocation.getRule());
Assert.assertEquals(0.25, englishAllocation.getRanges().get(0).getLength(), 1E-16);
Assert.assertEquals(0, englishAllocation.getRanges().get(0).getBucketValue());
Assert.assertEquals(0.75, englishAllocation.getRanges().get(1).getLength(), 1E-16);
Assert.assertEquals(1, englishAllocation.getRanges().get(1).getBucketValue());
final Allocation defaultAllocation = definition.getAllocations().get(1);
Assert.assertNull(defaultAllocation.getRule());
Assert.assertEquals(0.1, defaultAllocation.getRanges().get(0).getLength(), 1E-16);
Assert.assertEquals(0, defaultAllocation.getRanges().get(0).getBucketValue());
Assert.assertEquals(0.90, defaultAllocation.getRanges().get(1).getLength(), 1E-16);
Assert.assertEquals(1, defaultAllocation.getRanges().get(1).getBucketValue());