22 | * Since CDARichText do not have children, the parameter will be ignored.
23 | *
24 | * @param processor used for subrendering of children.
25 | */
26 | public HorizontalRuleRenderer(@Nonnull AndroidProcessor
14 | * Use one of the factory methods to create an Android processor creating your desired output.
15 | *
16 | * @see AndroidProcessor#creatingCharSequences()
17 | */
18 | public class AndroidProcessor
25 | * This element does not have any children.
26 | *
27 | * @param processor the unused processor for this renderer.
28 | */
29 | public HorizontalRuleRenderer(@Nonnull AndroidProcessor
", new ArrayList<>()));
24 |
25 | final String result = processor.process(context, link);
26 |
27 | assertThat(result).isEqualTo("" +
28 | "" +
29 | "Some link text<br/>" +
30 | "");
31 | }
32 |
33 | @Test
34 | public void renderLinkWithUriTest() {
35 | final HtmlProcessor processor = new HtmlProcessor();
36 | final HtmlContext context = new HtmlContext();
37 |
38 | final Map
", new ArrayList<>()));
42 |
43 | final String result = processor.process(context, link);
44 |
45 | assertThat(result).isEqualTo("" +
46 | "" +
47 | "Some link text<br/>" +
48 | "");
49 | }
50 |
51 | @Test
52 | public void createUnsanitzedStrings() {
53 | final HtmlProcessor processor = new HtmlProcessor();
54 | final HtmlContext context = new HtmlContext();
55 |
56 | final CDARichHyperLink link = new CDARichHyperLink("https://contentful.com");
57 | link.getContent().add(new CDARichText("Some link text", new ArrayList<>()));
58 |
59 | final String result = processor.process(context, link);
60 |
61 | assertThat(result).isEqualTo("" +
62 | "" +
63 | "Some link text</a>" +
64 | "");
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/android/src/test/java/chars/HeadingTest.java:
--------------------------------------------------------------------------------
1 | package chars;
2 |
3 | import android.app.Activity;
4 | import android.text.Spannable;
5 | import android.text.style.AbsoluteSizeSpan;
6 |
7 | import com.contentful.java.cda.rich.CDARichHeading;
8 | import com.contentful.java.cda.rich.CDARichText;
9 | import com.contentful.rich.android.AndroidContext;
10 | import com.contentful.rich.android.AndroidProcessor;
11 |
12 | import org.junit.Before;
13 | import org.junit.Test;
14 | import org.junit.runner.RunWith;
15 | import org.robolectric.Robolectric;
16 | import org.robolectric.RobolectricTestRunner;
17 |
18 | import java.util.ArrayList;
19 |
20 | import static com.google.common.truth.Truth.assertThat;
21 |
22 | @RunWith(RobolectricTestRunner.class)
23 | public class HeadingTest {
24 | private Activity activity;
25 |
26 | @Before
27 | public void setup() {
28 | activity = Robolectric.setupActivity(Activity.class);
29 | }
30 |
31 | @Test
32 | public void firstHeadingParsesContentTest() {
33 | final AndroidProcessor