### Question:
AwsChunkStream { public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } }  StreamingHttpRequest append(HttpChunk httpChunk); StreamingHttpRequest append(MappingHttpRequest initialRequest);  }### Answer:
@Test public void testAppend() throws Exception { ChannelBuffer content = ChannelBuffers.copiedBuffer(CHUNKED_STRING, Charsets.UTF_8); StreamingHttpRequest request = stream.append(new DefaultHttpChunk(content)); assertEquals(request.awsChunks.size(), 8); }
@Test public void testConvertAwsChunkToHttpChunk() throws Exception { ChannelBuffer content = ChannelBuffers.copiedBuffer(CHUNKED_STRING, Charsets.UTF_8); StreamingHttpRequest request = stream.append(new DefaultHttpChunk(content)); AwsChunk chunk = request.awsChunks.get(0); HttpChunk httpChunk = chunk.toHttpChunk(); assertEquals(httpChunk.getContent().readableBytes(), chunk.getContents().readableBytes() - 87); }