@@ -0,0 +1,2261 @@
+package com.basho.riak.client.core.converters;%0A%0Aimport com.basho.riak.client.core.query.RiakObject;%0Aimport com.basho.riak.client.core.util.BinaryValue;%0Aimport com.basho.riak.protobuf.RiakKvPB;%0Aimport com.google.protobuf.ByteString;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static junit.framework.TestCase.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class RiakObjectConverterTest%0A%7B%0A%0A    public static final String APPLICATION_JSON = %22application/json%22;%0A    public static final String UTF_8 = %22UTF-8%22;%0A%0A    @Test%0A    public void contentTypeAndCharsetAreEncodedProperly()%0A    %7B%0A        RiakObject riakObject = new RiakObject();%0A        riakObject.setContentType(APPLICATION_JSON);%0A        riakObject.setCharset(UTF_8);%0A        riakObject.setValue(BinaryValue.create(%22foo%22));%0A%0A        final RiakKvPB.RpbContent pbObject = RiakObjectConverter.convert(riakObject);%0A        assertTrue(pbObject.hasCharset());%0A        assertTrue(pbObject.hasContentType());%0A%0A        assertEquals(UTF_8, pbObject.getCharset().toStringUtf8());%0A        assertEquals(APPLICATION_JSON, pbObject.getContentType().toStringUtf8());%0A    %7D%0A%0A    @Test%0A    public void contentTypeAndCharsetAreDecodedProperly()%0A    %7B%0A        final RiakKvPB.RpbContent pbObject = RiakKvPB.RpbContent.newBuilder()%0A                                                            .setValue(ByteString.copyFromUtf8(%22foo%22))%0A                                                            .setContentType(ByteString.copyFromUtf8(APPLICATION_JSON))%0A                                                            .setCharset(ByteString.copyFromUtf8(UTF_8)).build();%0A%0A        final List%3CRiakObject%3E riakObjects = RiakObjectConverter.convert(%0A                new ArrayList%3CRiakKvPB.RpbContent%3E() %7B%7B add(pbObject); %7D%7D, ByteString.EMPTY);%0A%0A        assertEquals(1, riakObjects.size());%0A        final RiakObject riakObject = riakObjects.get(0);%0A        final String charset = riakObject.getCharset();%0A        final String contentType = riakObject.getContentType();%0A%0A        assertTrue(riakObject.hasCharset());%0A        assertTrue(contentType != null && !contentType.isEmpty());%0A%0A        assertEquals(UTF_8, charset);%0A        assertEquals(APPLICATION_JSON, contentType);%0A    %7D%0A%7D%0A

Create failing test