Translator { public void setLocale(Locale locale) { if (locale == null) { throw new NullPointerException("Locale is null"); } try { bundle = ResourceBundle.getBundle("Bundle", locale); } catch (MissingResourceException e) { System.err.println(); bundle = null; } } private  Translator(); static Translator getInstance(); String getString(String key); void setLocale(Locale locale); void setLocalizationDisabled(boolean localizationDisabled);  }
@Test(expected = NullPointerException.class) public void testNullException() { Locale loc = null; translator.setLocale(loc); }