1 package com.atlassian.security.auth.trustedapps;
2
3 import junit.framework.TestCase;
4
5 public class TestTransportErrorMessageParser extends TestCase
6 {
7 public void testParseSingle() throws Exception
8 {
9 TransportErrorMessage.Parser parser = new TransportErrorMessage.Parser();
10 TransportErrorMessage message = parser.parse(TransportErrorMessage.Code.OLD_CERT.toString() + ";\t" + "This is a message with a param: {0};\t[\"paramValue\"]");
11 assertNotNull(message);
12 assertEquals("This is a message with a param: paramValue", message.getFormattedMessage());
13 }
14
15 public void testParseThrowsIfTooShort() throws Exception
16 {
17 try
18 {
19 new TransportErrorMessage.Parser().parse("This is a message with a param: {0};\t[\"paramValue\"]");
20 fail("Should have thrown IllegalArgEx");
21 }
22 catch (IllegalArgumentException yay)
23 {
24 }
25 }
26 }