### Question:
FolderCreateProtocol extends ActiveSyncDecoder implements ActiveSyncProtocol<FolderCreateRequest, FolderCreateResponse> { @Override public Document encodeResponse(Device device, FolderCreateResponse folderCreateResponse) throws ProtocolException { Preconditions.checkArgument(folderCreateResponse != null, "FolderCreateResponse is null."); Document folderCreateResponseDocument = DOMUtils.createDoc(null, "FolderCreate"); Element root = folderCreateResponseDocument.getDocumentElement(); DOMUtils.createElementAndText(root, STATUS.getName(), folderCreateResponse.getStatus().asSpecificationValue()); DOMUtils.createElementAndText(root, SYNC_KEY.getName(), folderCreateResponse.getSyncKey().asString()); DOMUtils.createElementAndText(root, SERVER_ID.getName(), folderCreateResponse.getCollectionId().asString()); return folderCreateResponseDocument; }  Document encodeErrorResponse(FolderCreateStatus status); @Override FolderCreateRequest decodeRequest(Document requestDocument); @Override Document encodeRequest(FolderCreateRequest folderCreateRequest); @Override FolderCreateResponse decodeResponse(Document responseDocument); @Override Document encodeResponse(Device device, FolderCreateResponse folderCreateResponse);  }### Answer:
@Test public void testEncodeStatusOK() throws Exception { FolderCreateResponse folderCreateResponse = FolderCreateResponse.builder() .status(FolderCreateStatus.OK) .syncKey(new FolderSyncKey("1234")) .collectionId(CollectionId.of("11")) .build(); Document encodedDocument = folderCreateProtocol.encodeResponse(device, folderCreateResponse); assertThat(DOMUtils.serialize(encodedDocument)).isEqualTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<FolderCreate>" + "<Status>1</Status>" + "<SyncKey>1234</SyncKey>" + "<ServerId>11</ServerId>" + "</FolderCreate>"); }
@Test public void testEncodeStatusInvalidSyncKey() throws Exception { FolderCreateResponse folderCreateResponse = FolderCreateResponse.builder() .status(FolderCreateStatus.OK) .syncKey(new FolderSyncKey("1234")) .collectionId(CollectionId.of("11")) .build(); Document encodedDocument = folderCreateProtocol.encodeResponse(device, folderCreateResponse); assertThat(DOMUtils.serialize(encodedDocument)).isEqualTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<FolderCreate>" + "<Status>1</Status>" + "<SyncKey>1234</SyncKey>" + "<ServerId>11</ServerId>" + "</FolderCreate>"); }