-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.java
50 lines (39 loc) · 1.69 KB
/
output.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package testFiles;
import android.widget.SpinnerAdapter;
import com.dalthed.tucan.Connection.AnswerObject;
import com.dalthed.tucan.Connection.CookieManager;
import com.dalthed.tucan.scraper.EventsScraper;
import com.dalthed.tucan.testmodels.EventsModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import java.util.Map;
import static org.junit.Assert.*;
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class)
public class EventsScraperTest extends TestBase {
public EventsScraperTest() {
this.resourcesBaseName = "Events";
this.testClazzModel = EventsModel.class;
}
@Test
public void testSpinner() {
for (Map.Entry<String, String> entry : sourcesMap.entrySet()) {
String id = entry.getKey();
Object resultObject = resultsMap.get(id);
if (resultObject instanceof EventsModel) {
EventsModel result = (EventsModel) resultObject;
if (result.testSpinner.runTest) {
System.out.println("Testing " + id + " (testSpinner)");
//System.out.println(result);
AnswerObject answer = new AnswerObject(entry.getValue(), "", new CookieManager(), "");
EventsScraper scraper = new EventsScraper(RuntimeEnvironment.application, answer);
SpinnerAdapter spinnerAdapter = scraper.spinnerAdapter();
assertEquals(spinnerAdapter.getCount(), result.testSpinner.data.size());
}
}
}
}
}