mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
25 lines
785 B
Java
25 lines
785 B
Java
package fr.free.nrw.commons;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.robolectric.RobolectricTestRunner;
|
|
import org.robolectric.annotation.Config;
|
|
|
|
import static org.hamcrest.CoreMatchers.is;
|
|
import static org.junit.Assert.assertThat;
|
|
|
|
@RunWith(RobolectricTestRunner.class)
|
|
@Config(constants = BuildConfig.class, sdk = 21, application = TestCommonsApplication.class)
|
|
public class MediaTest {
|
|
@Test
|
|
public void displayTitleShouldStripExtension() {
|
|
Media m = new Media("File:Example.jpg");
|
|
assertThat(m.getDisplayTitle(), is("Example"));
|
|
}
|
|
|
|
@Test
|
|
public void displayTitleShouldUseSpaceForUnderscore() {
|
|
Media m = new Media("File:Example 1_2.jpg");
|
|
assertThat(m.getDisplayTitle(), is("Example 1 2"));
|
|
}
|
|
}
|