JOptionPane pane = new JOptionPane();
String message = "message message message message";
pane.setUI(paneUI);
pane.setMessageType(JOptionPane.ERROR_MESSAGE);
pane.setMessage(message);
Border messageAreaBorder = new BorderUIResource(BorderFactory.createEmptyBorder(3, 3,
3, 3));
UIManager.put("OptionPane.messageAreaBorder", messageAreaBorder);
paneUI.installDefaults();
assertEquals(messageAreaBorder, ((JComponent) paneUI.createMessageArea()).getBorder());
messageAreaBorder = new BorderUIResource(BorderFactory.createEmptyBorder(4, 4, 4, 4));
UIManager.put("OptionPane.messageAreaBorder", messageAreaBorder);
paneUI.installDefaults();
assertEquals(messageAreaBorder, ((JComponent) paneUI.createMessageArea()).getBorder());
JComponent messageArea = (JComponent) paneUI.createMessageArea();
assertTrue(messageArea instanceof JPanel);