@Override
    public CompletableFuture<SchemaVersion> putSchemaIfAbsent(String schemaId,
                                                              SchemaData schema,
                                                              SchemaCompatibilityStrategy strategy) {
        try {
            SchemaDataValidator.validateSchemaData(schema);
        } catch (InvalidSchemaDataException e) {
            return FutureUtil.failedFuture(e);
        }
        return service.putSchemaIfAbsent(schemaId, schema, strategy);
    }
@Test
    public void testPutSchemaIfAbsentWithBadSchemaData() {
        String schemaId = "test-schema-id";
        SchemaCompatibilityStrategy strategy = SchemaCompatibilityStrategy.FULL;
        CompletableFuture<SchemaVersion> future = new CompletableFuture<>();
        when(underlyingService.putSchemaIfAbsent(eq(schemaId), any(SchemaData.class), eq(strategy)))
            .thenReturn(future);
        SchemaData schemaData = SchemaData.builder()
            .type(SchemaType.BOOLEAN)
            .data(new byte[10])
            .build();
        try {
            service.putSchemaIfAbsent(schemaId, schemaData, strategy).get();
            fail("Should fail putSchemaIfAbsent");
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof InvalidSchemaDataException);
        }
        verify(underlyingService, times(0))
            .putSchemaIfAbsent(eq(schemaId), same(schemaData), eq(strategy));
    }