SettingsTestpublic class SettingsTest extends org.apache.struts2.StrutsTestCase Unit test for {@link SettingsTest}. |
Methods Summary |
---|
private int | getKeyCount()
int count = 0;
Iterator keyNames = Settings.list();
while (keyNames.hasNext()) {
keyNames.next();
count++;
}
return count;
| public void | testDefaultResourceBundlesLoaded()
assertEquals("testmessages,testmessages2", Settings.get(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES));
assertEquals("This is a test message", LocalizedTextUtil.findDefaultText("default.testmessage", Locale.getDefault()));
assertEquals("This is another test message", LocalizedTextUtil.findDefaultText("default.testmessage2", Locale.getDefault()));
| public void | testSetSettings()
Settings.setInstance(new TestSettings());
String keyName = "a.long.property.key.name";
assertEquals(keyName, Settings.get(keyName));
assertEquals(2, getKeyCount());
| public void | testSettings()
assertEquals("12345", Settings.get(StrutsConstants.STRUTS_MULTIPART_MAXSIZE));
assertEquals("\temp", Settings.get(StrutsConstants.STRUTS_MULTIPART_SAVEDIR));
assertEquals("test,org/apache/struts2/othertest", Settings.get( StrutsConstants.STRUTS_CUSTOM_PROPERTIES));
assertEquals("testvalue", Settings.get("testkey"));
assertEquals("othertestvalue", Settings.get("othertestkey"));
Locale locale = Settings.getLocale();
assertEquals("de", locale.getLanguage());
int count = getKeyCount();
assertEquals(11, count);
|
|