@Test public void test() { final String actual = new String(cut.serialize(null, event), StandardCharsets.UTF_8); assertEquals(expected, actual); }
@Override public byte[] serialize(final String topic, final CoffeeEvent event) { try { if (event == null) return null; final JsonbConfig config = new JsonbConfig() .withAdapters(new UUIDAdapter()) .withSerializers(new EventJsonbSerializer()); final Jsonb jsonb = JsonbBuilder.create(config); return jsonb.toJson(event, CoffeeEvent.class).getBytes(StandardCharsets.UTF_8); } catch (Exception e) { logger.severe("Could not serialize event: " + e.getMessage()); throw new SerializationException("Could not serialize event", e); } }
EventSerializer implements Serializer<CoffeeEvent> { @Override public byte[] serialize(final String topic, final CoffeeEvent event) { try { if (event == null) return null; final JsonbConfig config = new JsonbConfig() .withAdapters(new UUIDAdapter()) .withSerializers(new EventJsonbSerializer()); final Jsonb jsonb = JsonbBuilder.create(config); return jsonb.toJson(event, CoffeeEvent.class).getBytes(StandardCharsets.UTF_8); } catch (Exception e) { logger.severe("Could not serialize event: " + e.getMessage()); throw new SerializationException("Could not serialize event", e); } } }
EventSerializer implements Serializer<CoffeeEvent> { @Override public byte[] serialize(final String topic, final CoffeeEvent event) { try { if (event == null) return null; final JsonbConfig config = new JsonbConfig() .withAdapters(new UUIDAdapter()) .withSerializers(new EventJsonbSerializer()); final Jsonb jsonb = JsonbBuilder.create(config); return jsonb.toJson(event, CoffeeEvent.class).getBytes(StandardCharsets.UTF_8); } catch (Exception e) { logger.severe("Could not serialize event: " + e.getMessage()); throw new SerializationException("Could not serialize event", e); } }  }
EventSerializer implements Serializer<CoffeeEvent> { @Override public byte[] serialize(final String topic, final CoffeeEvent event) { try { if (event == null) return null; final JsonbConfig config = new JsonbConfig() .withAdapters(new UUIDAdapter()) .withSerializers(new EventJsonbSerializer()); final Jsonb jsonb = JsonbBuilder.create(config); return jsonb.toJson(event, CoffeeEvent.class).getBytes(StandardCharsets.UTF_8); } catch (Exception e) { logger.severe("Could not serialize event: " + e.getMessage()); throw new SerializationException("Could not serialize event", e); } }  @Override void configure(final Map<String, ?> configs, final boolean isKey); @Override byte[] serialize(final String topic, final CoffeeEvent event); @Override void close(); }
EventSerializer implements Serializer<CoffeeEvent> { @Override public byte[] serialize(final String topic, final CoffeeEvent event) { try { if (event == null) return null; final JsonbConfig config = new JsonbConfig() .withAdapters(new UUIDAdapter()) .withSerializers(new EventJsonbSerializer()); final Jsonb jsonb = JsonbBuilder.create(config); return jsonb.toJson(event, CoffeeEvent.class).getBytes(StandardCharsets.UTF_8); } catch (Exception e) { logger.severe("Could not serialize event: " + e.getMessage()); throw new SerializationException("Could not serialize event", e); } }  @Override void configure(final Map<String, ?> configs, final boolean isKey); @Override byte[] serialize(final String topic, final CoffeeEvent event); @Override void close();  }