View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.kuali.student.enrollment.test.util;
6   
7   import static org.junit.Assert.*;
8   import org.kuali.student.r2.common.dto.RichTextInfo;
9   
10  /**
11   * Helps test rich text
12   * @author nwright
13   */
14  public class RichTextTester {
15  
16      public void check(RichTextInfo expected, RichTextInfo actual) {
17          if (expected == null) {
18              if (actual == null) {
19                  return;
20              } else {
21                  if (actual.getPlain() == null && actual.getFormatted() == null) {
22                      fail("expected null but found an empty structure " + actual);
23                      return;
24                  }
25                  fail("expected null but found not null " + actual);
26                  return;
27              }
28          } else {
29              if (actual == null) {
30                  if (expected.getPlain() == null && expected.getFormatted() == null) {
31                      fail("expected empty structure but found null ");
32                      return;
33                  }
34                  fail("expected not null but found null " + expected);
35                  return;
36              } else {
37                  assertEquals(expected.getPlain(), actual.getPlain());
38                  assertEquals(expected.getFormatted(), actual.getFormatted());
39              }
40          }
41      }
42  }