PageRenderTime 19ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks-mail/src/test/java/com/google/sitebricks/mail/imap/ParsingTest.java

http://github.com/dhanji/sitebricks
Java | 35 lines | 25 code | 7 blank | 3 comment | 0 complexity | 76ae9bf77703ce86851491596cb50548 MD5 | raw file
 1package com.google.sitebricks.mail.imap;
 2
 3import org.testng.annotations.Test;
 4
 5import static org.testng.Assert.assertEquals;
 6
 7/**
 8 * @author dhanji@gmail.com (Dhanji R. Prasanna)
 9 */
10public class ParsingTest {
11  @Test
12  public final void normalizeDate() {
13    assertEquals("Thu, 07 Apr 2011 04:41:42 -0700",
14        Parsing.normalizeDateToken("Thu, 07 Apr 2011 04:41:42 -0700 (PDT)"));
15
16    assertEquals("Thu, 07 Apr 2011 04:41:42 -0700",
17        Parsing.normalizeDateToken("Thu,  07 Apr 2011 04:41:42 -0700 (PDT)"));
18  }
19
20  @Test
21  public final void addressParsing() {
22    assertEquals(
23        Parsing.readAddress(Parsing.tokenize("(\"Dhanji Prasanna\" NIL \"dhanji\" \"gmail.com\")")),
24        "\"Dhanji Prasanna\" dhanji@gmail.com");
25
26    assertEquals(
27        Parsing.readAddress(Parsing.tokenize("(Dhanji\\ Prasanna NIL \"dhanji\" \"gmail.com\")")),
28        "\"Dhanji Prasanna\" dhanji@gmail.com");
29
30    assertEquals(
31        Parsing.readAddress(Parsing.tokenize(
32            "(\"<newsletter=pukaraestate.com.au@mail85.us1.rsgsv.net>\" NIL \"\\\"Pukara Estate\\\"\" NIL)")),
33        "\"<newsletter=pukaraestate.com.au@mail85.us1.rsgsv.net>\" \"Pukara Estate\"@null");
34  }
35}