Run AtomTextTest with Robolectric (#4771)
This commit is contained in:
parent
c10d1a1d79
commit
72f4296150
|
@ -1,49 +0,0 @@
|
|||
package de.danoeh.antennapod.core.syndication.namespace.atom;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.junit.runners.Parameterized.Parameter;
|
||||
import static org.junit.runners.Parameterized.Parameters;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for {@link AtomText}.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class AtomTextTest {
|
||||
|
||||
@Parameter(value = 0)
|
||||
public String input;
|
||||
|
||||
@Parameter(value = 1)
|
||||
public String expectedOutput;
|
||||
|
||||
@Parameters
|
||||
public static Collection<Object[]> initParameters() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{">", ">"},
|
||||
{">", ">"},
|
||||
{"<Français>", "<Français>"},
|
||||
{"ßÄÖÜ", "ßÄÖÜ"},
|
||||
{""", "\""},
|
||||
{"ß", "ß"},
|
||||
{"’", "’"},
|
||||
{"‰", "‰"},
|
||||
{"€", "€"},
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessingHtml() {
|
||||
final AtomText atomText = new AtomText("", new NSAtom(), AtomText.TYPE_HTML);
|
||||
atomText.setContent(input);
|
||||
assertEquals(expectedOutput, atomText.getProcessedContent());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package de.danoeh.antennapod.core.syndication.namespace.atom;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for {@link AtomText}.
|
||||
*/
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AtomTextTest {
|
||||
|
||||
private static final String[][] TEST_DATA = {
|
||||
{">", ">"},
|
||||
{">", ">"},
|
||||
{"<Français>", "<Français>"},
|
||||
{"ßÄÖÜ", "ßÄÖÜ"},
|
||||
{""", "\""},
|
||||
{"ß", "ß"},
|
||||
{"’", "’"},
|
||||
{"‰", "‰"},
|
||||
{"€", "€"}
|
||||
};
|
||||
|
||||
@Test
|
||||
public void testProcessingHtml() {
|
||||
for (String[] pair : TEST_DATA) {
|
||||
final AtomText atomText = new AtomText("", new NSAtom(), AtomText.TYPE_HTML);
|
||||
atomText.setContent(pair[0]);
|
||||
assertEquals(pair[1], atomText.getProcessedContent());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue