### Question:
MsoCommonUtils { protected MsoException neutronExceptionToMsoException(OpenStackBaseException e, String context) { MsoException me = null; if (e instanceof OpenStackResponseException) { OpenStackResponseException re = (OpenStackResponseException) e; try { NeutronError error = re.getResponse().getErrorEntity(NeutronError.class); logger.error("{} {} Openstack Neutron Error on {} {}", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), context, error); me = new MsoOpenstackException(re.getStatus(), error.getType(), error.getMessage()); } catch (Exception e2) { logger.error("{} {} Openstack HTTP Error on {}: {}, {}", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); me = new MsoOpenstackException(re.getStatus(), re.getMessage(), null); } me.addContext(context); if (re.getStatus() >= 500) { logger.error("{} {} OpenStackBaseException with response code {} on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), re.getStatus(), context, e); } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; me = new MsoIOException(ce.getMessage()); me.addContext(context); logger.error("{} {} Openstack Neutron Connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), context, e); } return me; }  T executeAndRecordOpenstackRequest(OpenStackRequest<T> request); MsoException keystoneErrorToMsoException(OpenStackBaseException e, String context); boolean isNullOrEmpty(String s);  }### Answer:
@Test public final void testNeutronExceptionToMsoException() throws JsonParseException, JsonMappingException, IOException { OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); OpenStackBaseException openStackResponseException = new OpenStackResponseException("response", 1); MsoException me = commonUtils.neutronExceptionToMsoException(openStackConnectException, "ContextError"); assertTrue(me instanceof MsoIOException); assertTrue("connect".equals(me.getMessage())); MsoException me2 = commonUtils.neutronExceptionToMsoException(openStackResponseException, "ContextError"); assertTrue(me2 instanceof MsoOpenstackException); assertTrue("ContextError".equals(me2.getContext())); assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class); NeutronError explanation = mapper.readValue(new File(RESOURCE_PATH + "NeutronError.json"), NeutronError.class); doReturn(explanation).when(openStackResponse).getErrorEntity(eq(NeutronError.class)); openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); MsoException me3 = commonUtils.neutronExceptionToMsoException(openStackResponseException, "ContextError"); assertTrue(me3 instanceof MsoOpenstackException); assertEquals("501 type: message", me3.toString()); }