|
@ -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);; |
|
|