### Question:
XException extends Exception { private XException(ERROR error, String message, Throwable cause) { super(message, cause); this.error = error; } private  XException(ERROR error, String message, Throwable cause);  XException(XException cause); @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})  XException(ERROR error, Object... params); ERROR getError();  }### Answer:
@Test public void testXException() throws Exception { XException ex = new XException(TestERROR.TC); assertEquals(ex.getError(), TestERROR.TC); assertEquals(ex.getMessage(), "TC: {0}"); assertNull(ex.getCause()); ex = new XException(TestERROR.TC, "msg"); assertEquals(ex.getError(), TestERROR.TC); assertEquals(ex.getMessage(), "TC: msg"); assertNull(ex.getCause()); Exception cause = new Exception(); ex = new XException(TestERROR.TC, cause); assertEquals(ex.getError(), TestERROR.TC); assertEquals(ex.getMessage(), "TC: " + cause.toString()); assertEquals(ex.getCause(), cause); XException xcause = ex; ex = new XException(xcause); assertEquals(ex.getError(), TestERROR.TC); assertEquals(ex.getMessage(), xcause.getMessage()); assertEquals(ex.getCause(), xcause); }