### Question:
ConfluentSchemaRegistryWriter implements SchemaAccessWriter { @Override public void validateSchema(RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier identifier = schema.getIdentifier(); final OptionalLong identifierOption = identifier.getIdentifier(); if (!identifierOption.isPresent()) { throw new SchemaNotFoundException("Cannot write Confluent Schema Registry Reference because the Schema Identifier is not known"); } final OptionalInt versionOption = identifier.getVersion(); if (!versionOption.isPresent()) { throw new SchemaNotFoundException("Cannot write Confluent Schema Registry Reference because the Schema Version is not known"); } }  @Override void writeHeader(final RecordSchema schema, final OutputStream out); @Override Map<String, String> getAttributes(final RecordSchema schema); @Override void validateSchema(RecordSchema schema); @Override Set<SchemaField> getRequiredSchemaFields();  }### Answer:
@Test public void testValidateValidSchema() throws SchemaNotFoundException { final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().id(123456L).version(2).build(); final RecordSchema recordSchema = createRecordSchema(schemaIdentifier); final SchemaAccessWriter schemaAccessWriter = new ConfluentSchemaRegistryWriter(); schemaAccessWriter.validateSchema(recordSchema); }
@Test(expected = SchemaNotFoundException.class) public void testValidateInvalidSchema() throws SchemaNotFoundException { final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().name("test").build(); final RecordSchema recordSchema = createRecordSchema(schemaIdentifier); final SchemaAccessWriter schemaAccessWriter = new ConfluentSchemaRegistryWriter(); schemaAccessWriter.validateSchema(recordSchema); }