use of io.druid.TestObjectMapper in project druid by druid-io.
the class NoneShardSpecTest method testPartitionFieldIgnored.
@Test
public void testPartitionFieldIgnored() throws IOException {
final String jsonStr = "{\"type\": \"none\",\"partitionNum\": 2}";
ObjectMapper mapper = new TestObjectMapper();
final ShardSpec noneShardSpec = mapper.readValue(jsonStr, ShardSpec.class);
noneShardSpec.equals(NoneShardSpec.instance());
}
use of io.druid.TestObjectMapper in project druid by druid-io.
the class NoneShardSpecTest method testSerde.
@Test
public void testSerde() throws Exception {
final NoneShardSpec one = NoneShardSpec.instance();
ObjectMapper mapper = new TestObjectMapper();
NoneShardSpec serde1 = mapper.readValue(mapper.writeValueAsString(one), NoneShardSpec.class);
NoneShardSpec serde2 = mapper.readValue(mapper.writeValueAsString(one), NoneShardSpec.class);
// Serde should return same object instead of creating new one every time.
Assert.assertTrue(serde1 == serde2);
Assert.assertTrue(one == serde1);
}
Aggregations