Browse Source

Remove duplicate json from test

develop
Ezerous 3 years ago
parent
commit
ca4e94763a
  1. 4
      app/build.gradle
  2. 5
      app/src/test/java/gr/thmmy/mthmmy/utils/UploadsCoursesJSONReadingTest.java
  3. 1702
      app/src/test/resources/raw/uploads_courses.json

4
app/build.gradle

@ -37,6 +37,10 @@ android {
} }
} }
sourceSets {
test.resources.srcDirs += 'src/main/res/raw'
}
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8

5
app/src/test/java/gr/thmmy/mthmmy/utils/UploadsCoursesJSONReadingTest.java

@ -12,7 +12,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import gr.thmmy.mthmmy.activities.upload.UploadsCourse; import gr.thmmy.mthmmy.activities.upload.UploadsCourse;
import gr.thmmy.mthmmy.utils.io.ResourceUtils; import gr.thmmy.mthmmy.utils.io.ResourceUtils;
@ -24,14 +23,14 @@ import static org.junit.Assert.assertTrue;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest(JSONObject.class) @PrepareForTest(JSONObject.class)
public class UploadsCoursesJSONReadingTest { public class UploadsCoursesJSONReadingTest {
private final String filePath = "/raw/uploads_courses.json"; private final String filePath = "uploads_courses.json";
@Rule @Rule
public TimberTestRule logAllAlwaysRule = TimberTestRule.logAllAlways(); public TimberTestRule logAllAlwaysRule = TimberTestRule.logAllAlways();
@Test @Test
public void uploadsCoursesRetrievedCorrectly() throws Exception { public void uploadsCoursesRetrievedCorrectly() throws Exception {
InputStream is = this.getClass().getResourceAsStream(filePath); InputStream is = this.getClass().getClassLoader().getResourceAsStream(filePath);
assertNotNull(is); assertNotNull(is);
String uploadsCoursesJSON = ResourceUtils.readJSONResourceToString(is); String uploadsCoursesJSON = ResourceUtils.readJSONResourceToString(is);
assertNotNull(uploadsCoursesJSON);; assertNotNull(uploadsCoursesJSON);;

1702
app/src/test/resources/raw/uploads_courses.json

File diff suppressed because it is too large
Loading…
Cancel
Save