@Test public void testSimpleMapWithNull() { final Map<String, AttributeValue> map = new HashMap<>(); map.put("KeyValue", AttributeValueBuilder.ofS("ValueValue")); map.put("NullKeyValue", null); final AttributeValue av = AttributeValueBuilder.ofM(map); try { marshall(av); fail("NullPointerException should have been thrown"); } catch (NullPointerException e) { assertThat(e.getMessage(), startsWith("Encountered null map value for key NullKeyValue while marshalling " + "attribute value")); } }
public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); static ByteBuffer marshall(final AttributeValue attributeValue); static AttributeValue unmarshall(final ByteBuffer plainText); }
AttributeValueMarshaller { public static ByteBuffer marshall(final AttributeValue attributeValue) { try (ByteArrayOutputStream resultBytes = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(resultBytes);) { marshall(attributeValue, out); out.close(); resultBytes.close(); return ByteBuffer.wrap(resultBytes.toByteArray()); } catch (final IOException ex) { throw new RuntimeException("Unexpected exception", ex); } } private  AttributeValueMarshaller(); static ByteBuffer marshall(final AttributeValue attributeValue); static AttributeValue unmarshall(final ByteBuffer plainText);  }