@Test public void testValueNonNull() { Base64Converter converter = new Base64Converter(); JsonNode node = new TextNode("bXl0ZXN0"); byte[] bytes = (byte[]) converter.valueNonNull(node); assertNotNull(bytes); assertArrayEquals(new byte[] { 'm', 'y', 't', 'e', 's', 't' }, bytes); }
@Override protected byte[] valueNonNull(JsonNode node) { if (!node.isTextual()) { throw new AgException(Status.BAD_REQUEST, "Expected textual value, got: " + node.asText()); } try { return Base64.getDecoder().decode(node.asText()); } catch (IllegalArgumentException e) { throw new AgException(Status.BAD_REQUEST, "Failed to decode Base64 value: " + node.asText(), e); } }
Base64Converter extends AbstractConverter<byte[]> { @Override protected byte[] valueNonNull(JsonNode node) { if (!node.isTextual()) { throw new AgException(Status.BAD_REQUEST, "Expected textual value, got: " + node.asText()); } try { return Base64.getDecoder().decode(node.asText()); } catch (IllegalArgumentException e) { throw new AgException(Status.BAD_REQUEST, "Failed to decode Base64 value: " + node.asText(), e); } } }
Base64Converter extends AbstractConverter<byte[]> { @Override protected byte[] valueNonNull(JsonNode node) { if (!node.isTextual()) { throw new AgException(Status.BAD_REQUEST, "Expected textual value, got: " + node.asText()); } try { return Base64.getDecoder().decode(node.asText()); } catch (IllegalArgumentException e) { throw new AgException(Status.BAD_REQUEST, "Failed to decode Base64 value: " + node.asText(), e); } }  }
Base64Converter extends AbstractConverter<byte[]> { @Override protected byte[] valueNonNull(JsonNode node) { if (!node.isTextual()) { throw new AgException(Status.BAD_REQUEST, "Expected textual value, got: " + node.asText()); } try { return Base64.getDecoder().decode(node.asText()); } catch (IllegalArgumentException e) { throw new AgException(Status.BAD_REQUEST, "Failed to decode Base64 value: " + node.asText(), e); } }  static Base64Converter converter(); }
Base64Converter extends AbstractConverter<byte[]> { @Override protected byte[] valueNonNull(JsonNode node) { if (!node.isTextual()) { throw new AgException(Status.BAD_REQUEST, "Expected textual value, got: " + node.asText()); } try { return Base64.getDecoder().decode(node.asText()); } catch (IllegalArgumentException e) { throw new AgException(Status.BAD_REQUEST, "Failed to decode Base64 value: " + node.asText(), e); } }  static Base64Converter converter();  }