1 package net.jaekl.cfb.analyze;
3 import static org.junit.Assert.assertTrue;
5 import java.io.IOException;
7 import net.jaekl.cfb.CfbBundleMock;
8 import net.jaekl.cfb.Config;
10 import org.junit.Before;
11 import org.junit.Test;
13 public class NotifierTest {
14 private CfbBundleMock m_bundle;
15 private Config m_config;
16 private MessageMapMock m_msgMap;
17 private NotifierMock m_notifier;
21 m_bundle = new CfbBundleMock();
22 m_config = new Config();
23 m_msgMap = new MessageMapMock();
24 m_notifier = new NotifierMock(m_bundle, m_config);
28 public void testConstructSubject_noPrior() throws IOException {
31 "ProjectNameGoesHere",
33 "[cfb.mail.subject][[no.earlier.run]][[version.num][",
37 "ProjectNameGoesHere",
39 "[cfb.mail.subject][[no.earlier.run]][[analyzed.at][",
45 "[cfb.mail.subject][[no.earlier.run]][[version.num][",
51 "[cfb.mail.subject][[no.earlier.run]][[analyzed.at][",
56 for (String[] datum : data) {
57 String projectName = datum[0];
58 String buildNumber = datum[1];
59 String expectedPart1 = datum[2];
60 String expectedPart2 = datum[3];
62 Analysis first = null;
63 Analysis second = new Analysis(projectName, buildNumber);
65 Delta delta = new Delta(first, second);
66 HtmlReport htmlReport = new HtmlReport(m_bundle, m_msgMap.getColl(), delta);
68 String actual = m_notifier.constructSubject(htmlReport);
69 boolean pass = (actual.startsWith(expectedPart1)) && (actual.endsWith(expectedPart2));
71 System.out.println("ProjectName:\n" + projectName + "\nVersion:\n" + buildNumber
72 + "\nExpected:\n" + expectedPart1 + "{date}" + expectedPart2 + "\nActual:\n" + actual);