@Test
  public void simpleTest() {
    final String id = "1";

    SchemaRegistryMultiple registry = createSchemaRegistry();

    // Get schema for ads
    Schema tempAdsSchema = registry.getSchema(SCHEMA_ADS_KEYS);
    Assert.assertEquals(SCHEMA_ADS_KEYS, tempAdsSchema.getSchemaKeys());

    // Get schema for sales
    Schema tempSalesSchema = registry.getSchema(SCHEMA_SALES_KEYS);
    Assert.assertEquals(SCHEMA_SALES_KEYS, tempSalesSchema.getSchemaKeys());

    // Query schema for ads
    SchemaQuery schemaQueryAds = new SchemaQuery(id, SCHEMA_ADS_KEYS);
    SchemaResult result = registry.getSchemaResult(schemaQueryAds);
    Assert.assertEquals(1, result.getGenericSchemas().length);
    Assert.assertEquals(SCHEMA_ADS_KEYS, result.getGenericSchemas()[0].getSchemaKeys());

    // Query schema for sales
    SchemaQuery schemaQuerySales = new SchemaQuery(id, SCHEMA_SALES_KEYS);
    result = registry.getSchemaResult(schemaQuerySales);
    Assert.assertEquals(1, result.getGenericSchemas().length);
    Assert.assertEquals(SCHEMA_SALES_KEYS, result.getGenericSchemas()[0].getSchemaKeys());
  }
  @Test
  public void serializationTest() throws Exception {
    SchemaRegistryMultiple schemaRegistryMultiple = createSchemaRegistry();

    schemaRegistryMultiple = KryoCloneUtils.cloneObject(schemaRegistryMultiple);

    Assert.assertEquals(2, schemaRegistryMultiple.size());
  }
  private SchemaRegistryMultiple createSchemaRegistry() {
    MockSchema schemaAds = new MockSchema();
    final Map<String, String> schemaAdsKeys = Maps.newHashMap();
    schemaAdsKeys.put("type", "ads");

    MockSchema schemaSales = new MockSchema();
    final Map<String, String> schemaSalesKeys = Maps.newHashMap();
    schemaSalesKeys.put("type", "sales");

    SchemaRegistryMultiple registry = new SchemaRegistryMultiple(Lists.newArrayList("type"));
    registry.registerSchema(schemaAds, schemaAdsKeys);
    registry.registerSchema(schemaSales, schemaSalesKeys);

    return registry;
  }