### Question:
ItemOperationsHandler extends WbxmlRequestHandler { @VisibleForTesting static boolean isAcceptGZip(ActiveSyncRequest request) { String acceptEncoding = request.getHeader(HttpHeaders.ACCEPT_ENCODING); return acceptEncoding != null && acceptEncoding.contains("gzip"); } @Inject protected  ItemOperationsHandler(IContentsImporter contentsImporter,
			IContentsExporter contentsExporter, ItemOperationsProtocol.Factory protocolFactory,
			WBXMLTools wbxmlTools, MailBackend mailBackend, 
			DOMDumper domDumper, FolderSnapshotDao folderSnapshotDao); @Override void process(IContinuation continuation, UserDataRequest udr,
			Document doc, ActiveSyncRequest request, Responder responder);  }### Answer:
@Test public void testAcceptGzipWhenNull() { ActiveSyncRequest request = createMock(ActiveSyncRequest.class); expect(request.getHeader(HttpHeaders.ACCEPT_ENCODING)).andReturn(null); replay(request); assertThat(ItemOperationsHandler.isAcceptGZip(request)).isFalse(); verify(request); }
@Test public void testAcceptGzipWhenEmpty() { ActiveSyncRequest request = createMock(ActiveSyncRequest.class); expect(request.getHeader(HttpHeaders.ACCEPT_ENCODING)).andReturn(""); replay(request); assertThat(ItemOperationsHandler.isAcceptGZip(request)).isFalse(); verify(request); }
@Test public void testAcceptGzipWhenTrue() { ActiveSyncRequest request = createMock(ActiveSyncRequest.class); expect(request.getHeader(HttpHeaders.ACCEPT_ENCODING)).andReturn("true"); replay(request); assertThat(ItemOperationsHandler.isAcceptGZip(request)).isFalse(); verify(request); }
@Test public void testAcceptGzipWhenFalse() { ActiveSyncRequest request = createMock(ActiveSyncRequest.class); expect(request.getHeader(HttpHeaders.ACCEPT_ENCODING)).andReturn("false"); replay(request); assertThat(ItemOperationsHandler.isAcceptGZip(request)).isFalse(); verify(request); }
@Test public void testAcceptGzipWhenExpectedValue() { ActiveSyncRequest request = createMock(ActiveSyncRequest.class); expect(request.getHeader(HttpHeaders.ACCEPT_ENCODING)).andReturn("gzip"); replay(request); assertThat(ItemOperationsHandler.isAcceptGZip(request)).isTrue(); verify(request); }