### Question:
CommunicationErrorException extends BaseException { public static CommunicationErrorException fromStatusCode(int statusCode, String message) { String code = String.valueOf(statusCode); Class<? extends CommunicationErrorException> clazz = STATUS_MAP.get(code); if (clazz == null) clazz = CommunicationErrorException.class; try { Constructor<? extends CommunicationErrorException> c = clazz.getDeclaredConstructor(String.class, Throwable.class, String.class); c.setAccessible(true); return c.newInstance(message, null, code); } catch (NoSuchMethodException|IllegalAccessException|InstantiationException|InvocationTargetException e) { return new CommunicationErrorException(message, null, code); } } CommunicationErrorException(String message, Throwable cause, String errorCode); static CommunicationErrorException fromStatusCode(int statusCode, String message);  }### Answer:
@Test public void from401IsUnauthorized() throws Exception { assertEquals(new Unauthorized("Message", null, "401"), CommunicationErrorException.fromStatusCode(401, "Message")); }
@Test public void from403IsForbidden() throws Exception { assertEquals(new Unauthorized("Message", null, "403"), CommunicationErrorException.fromStatusCode(403, "Message")); }
@Test public void from404IsEntityNotFound() throws Exception { assertEquals(new Unauthorized("Message", null, "404"), CommunicationErrorException.fromStatusCode(404, "Message")); }
@Test public void from408IsTimedOut() throws Exception { assertEquals(new Unauthorized("Message", null, "408"), CommunicationErrorException.fromStatusCode(408, "Message")); }
@Test public void from429IsRateLimited() throws Exception { assertEquals(new Unauthorized("Message", null, "429"), CommunicationErrorException.fromStatusCode(429, "Message")); }