### Question:
AvroConverter { public AvroEvent toAvro(Event<?, ?> event) { var avroConverter = avroConverter(event.getKey()); if (event instanceof SpecificationEvent) { return avroConverter.toAvro((SpecificationEvent<?, ?>) event); } else if (event instanceof StatusEvent) { return avroConverter.toAvro((StatusEvent<?, ?>) event); } else if (event instanceof SpecificationDeletionEvent) { return avroConverter.toAvro((SpecificationDeletionEvent<?, ?>) event); } else if (event instanceof StatusDeletionEvent) { return avroConverter.toAvro((StatusDeletionEvent<?, ?>) event); } else { throw new IllegalArgumentException("Unknown event " + event); } }  Event<?, ?> toModel(AvroKey avroKey, AvroValue avroValue); AvroEvent toAvro(Event<?, ?> event);  }### Answer:
@Test public void streamSpecificationToAvro() throws IOException { var result = underTest.toAvro(Event.specification(streamKey, streamSpecification)); assertEquals(avroStreamSpecificationEvent.toByteBuffer(), result.toByteBuffer()); }
@Test public void specificationToAvro() throws IOException { var result = underTest.toAvro(Event.specification(domainKey, specification)); assertEquals(avroSpecificationEvent.toByteBuffer(), result.toByteBuffer()); }
@Test public void specificationDeleteToAvro() throws IOException { var result = underTest.toAvro(Event.specificationDeletion(domainKey)); assertEquals(avroSpecificationDeletionEvent.toByteBuffer(), result.toByteBuffer()); }
@Test public void statusToAvro() throws IOException { var result = underTest.toAvro(Event.status(domainKey, statusEntry)); assertEquals(avroStatusEvent.toByteBuffer(), result.toByteBuffer()); }
@Test public void statusDeleteToAvro() throws IOException { var result = underTest.toAvro(Event.statusDeletion(domainKey, "statusName")); assertEquals(avroStatusDeletionEvent.toByteBuffer(), result.toByteBuffer()); }