mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 22:34:02 +01:00
Use JSON APIs for explore (#2731)
* Use JSON APIs for explore * With tests * Use JSON APIs for explore * With tests * BugFix #2731 (#4) * Increased sdk version to 23 * with more robust tests * Fix crashes and other reported issues * Add javadocs * Use common method for search and categories * Add javadocs
This commit is contained in:
parent
c1a941eaae
commit
c45b945526
14 changed files with 468 additions and 318 deletions
|
|
@ -0,0 +1,40 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class MediaDataExtractorUtilTest {
|
||||
|
||||
@Test
|
||||
public void extractCategoriesFromList() {
|
||||
List<String> strings = MediaDataExtractorUtil.extractCategoriesFromList("Watercraft 2018|Watercraft|2018");
|
||||
assertEquals(strings.size(), 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void extractCategoriesFromEmptyList() {
|
||||
List<String> strings = MediaDataExtractorUtil.extractCategoriesFromList("");
|
||||
assertEquals(strings.size(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void extractCategoriesFromNullList() {
|
||||
List<String> strings = MediaDataExtractorUtil.extractCategoriesFromList(null);
|
||||
assertEquals(strings.size(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void extractCategoriesFromListWithEmptyValues() {
|
||||
List<String> strings = MediaDataExtractorUtil.extractCategoriesFromList("Watercraft 2018||");
|
||||
assertEquals(strings.size(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void extractCategoriesFromListWithWhitespaces() {
|
||||
List<String> strings = MediaDataExtractorUtil.extractCategoriesFromList("Watercraft 2018| | ||");
|
||||
assertEquals(strings.size(), 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue