### Question:
JmsExceptionSupport { public static JMSException create(String message, Throwable cause) { if (cause instanceof JMSException) { return (JMSException) cause; } if (cause.getCause() instanceof JMSException) { return (JMSException) cause.getCause(); } else if (cause instanceof ProviderException) { return ((ProviderException) cause).toJMSException(); } if (message == null || message.isEmpty()) { message = cause.getMessage(); if (message == null || message.isEmpty()) { message = cause.toString(); } } JMSException exception = new JMSException(message); if (cause instanceof Exception) { exception.setLinkedException((Exception) cause); } exception.initCause(cause); return exception; } private  JmsExceptionSupport(); static JMSException create(String message, Throwable cause); static JMSException create(Throwable cause); static MessageEOFException createMessageEOFException(Throwable cause); static MessageFormatException createMessageFormatException(Throwable cause); static JMSRuntimeException createRuntimeException(Exception exception);  }### Answer:
@Test public void testCreateAssignsLinkedException() { JMSException result = JmsExceptionSupport.create(ERROR_MESSAGE, new IOException(CAUSE_MESSAGE)); assertNotNull(result.getLinkedException()); }
@Test public void testCreateDoesNotFillLinkedExceptionWhenGivenNonExceptionThrowable() { JMSException result = JmsExceptionSupport.create(ERROR_MESSAGE, new AssertionError(CAUSE_MESSAGE)); assertNull(result.getLinkedException()); }
@Test public void testCreateFillsMessageFromMessageParam() { JMSException result = JmsExceptionSupport.create(ERROR_MESSAGE, new IOException(CAUSE_MESSAGE)); assertEquals(ERROR_MESSAGE, result.getMessage()); }
@Test public void testCreateFillsMessageFromMCauseessageParamMessage() { JMSException result = JmsExceptionSupport.create(new IOException(CAUSE_MESSAGE)); assertEquals(CAUSE_MESSAGE, result.getMessage()); }
@Test public void testCreateFillsMessageFromMCauseessageParamToString() { JMSException result = JmsExceptionSupport.create(NO_MESSAGE_CAUSE); assertEquals(NO_MESSAGE_CAUSE.toString(), result.getMessage()); }
@Test public void testCreateFillsMessageFromMCauseessageParamToStringWhenMessageIsEmpty() { JMSException result = JmsExceptionSupport.create(EMPTY_MESSAGE_CAUSE); assertEquals(EMPTY_MESSAGE_CAUSE.toString(), result.getMessage()); }
@Test public void testCreateFillsMessageFromCauseMessageParamWhenErrorMessageIsNull() { JMSException result = JmsExceptionSupport.create(null, new IOException(CAUSE_MESSAGE)); assertEquals(CAUSE_MESSAGE, result.getMessage()); }
@Test public void testCreateFillsMessageFromCauseMessageParamWhenErrorMessageIsEmpty() { JMSException result = JmsExceptionSupport.create("", new IOException(CAUSE_MESSAGE)); assertEquals(CAUSE_MESSAGE, result.getMessage()); }