### Question:
MetaUtil { public static DefaultResponse convertHeaderToResponse(Header header) { ResponseInfo responseInfo = header.getResponseInfo(); if (responseInfo == null) { throw new ProtocolException("Deserialize request: lack ResponseInfo."); } DefaultResponse response = new DefaultResponse(responseInfo.getSequenceId()); response.setOctoProtocol(true); response.setStatusCode(responseInfo.getStatus()); if (header.getMessageType() == MessageType.NormalHeartbeat.getValue()) { response.setMessageType(Constants.MESSAGE_TYPE_HEART); } else if (header.getMessageType() == MessageType.Normal.getValue()) { response.setMessageType(Constants.MESSAGE_TYPE_SERVICE); } else { throw new ProtocolException("Deserialize unknown messageType."); } response.setGlobalContexts(header.getGlobalContext()); response.putLocalContexts(header.getLocalContext()); return response; }  static Header convertRequestToHeader(DefaultRequest request); static DefaultRequest convertHeaderToRequest(Header header); static DefaultResponse convertHeaderToResponse(Header header); static Header convertResponseToHeader(DefaultResponse response); static RequestHeader convertRequestToOldProtocolHeader(DefaultRequest request); static DefaultRequest convertOldProtocolHeaderToRequest(RequestHeader header, DefaultRequest request); static void recordTraceInfoInDecode(byte[] msgBuff, Object message); static void recordTraceInfoInEncode(byte[] msgBuff, Object message); static void wrapException(Exception exception, DefaultResponse response);  }### Answer:
@Test public void testHeaderToResponse() { try { MetaUtil.convertHeaderToResponse(header); } catch(Exception e) { Assert.assertTrue(e instanceof ProtocolException); } when(header.getResponseInfo()).thenReturn(responseInfo); when(header.getMessageType()).thenReturn((byte) MessageType.Normal.getValue()); when(header.getMessageType()).thenReturn((byte) 3); try { MetaUtil.convertHeaderToResponse(header); } catch(Exception e) { Assert.assertTrue(e instanceof TimeoutException); } }