assertEquals("Here\'s a Locator: 12:7", msg);
}
public void testIfFormatting() throws Exception {
String msg;
AdvancedMessageFormat format;
format = new AdvancedMessageFormat("You are{isBad,if, not} nice!");
Map params = new java.util.HashMap();
params.put("isBad", Boolean.FALSE);
msg = format.format(params);
assertEquals("You are nice!", msg);
params.put("isBad", Boolean.TRUE);
msg = format.format(params);
assertEquals("You are not nice!", msg);
format = new AdvancedMessageFormat("You are{isGood,if, very, not so} nice!");
params = new java.util.HashMap();
msg = format.format(params); //isGood is missing
assertEquals("You are not so nice!", msg);
params.put("isGood", Boolean.FALSE);
msg = format.format(params);
assertEquals("You are not so nice!", msg);
params.put("isGood", Boolean.TRUE);
msg = format.format(params);
assertEquals("You are very nice!", msg);
format = new AdvancedMessageFormat("You are{isGood,if, very\\, very} nice!");
params = new java.util.HashMap();
msg = format.format(params); //isGood is missing
assertEquals("You are nice!", msg);
params.put("isGood", Boolean.FALSE);
msg = format.format(params);
assertEquals("You are nice!", msg);
params.put("isGood", Boolean.TRUE);
msg = format.format(params);
assertEquals("You are very, very nice!", msg);
}