@Test public void testErrorMessage() { assumeTrue(AnsiConsole.IS_WINDOWS); String msg = WindowsSupport.getErrorMessage(500); assertEquals(msg, "User profile cannot be loaded."); }
public static String getErrorMessage(int errorCode) { int bufferSize = 160; byte data[] = new byte[bufferSize]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); try { return new String(data, "UTF-16LE").trim(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
WindowsSupport { public static String getErrorMessage(int errorCode) { int bufferSize = 160; byte data[] = new byte[bufferSize]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); try { return new String(data, "UTF-16LE").trim(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } } }
WindowsSupport { public static String getErrorMessage(int errorCode) { int bufferSize = 160; byte data[] = new byte[bufferSize]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); try { return new String(data, "UTF-16LE").trim(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }  }
WindowsSupport { public static String getErrorMessage(int errorCode) { int bufferSize = 160; byte data[] = new byte[bufferSize]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); try { return new String(data, "UTF-16LE").trim(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }  static String getLastErrorMessage(); static String getErrorMessage(int errorCode); }
WindowsSupport { public static String getErrorMessage(int errorCode) { int bufferSize = 160; byte data[] = new byte[bufferSize]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); try { return new String(data, "UTF-16LE").trim(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }  static String getLastErrorMessage(); static String getErrorMessage(int errorCode);  }