forked from jaredsburrows/android-gradle-java-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AdUtilsTest.java
36 lines (31 loc) · 1.37 KB
/
AdUtilsTest.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
package burrows.apps.example.template.util;
import org.junit.Test;
import static burrows.apps.example.template.util.AdUtils.getErrorReason;
import static com.google.android.gms.ads.AdRequest.ERROR_CODE_INTERNAL_ERROR;
import static com.google.android.gms.ads.AdRequest.ERROR_CODE_INVALID_REQUEST;
import static com.google.android.gms.ads.AdRequest.ERROR_CODE_NETWORK_ERROR;
import static com.google.android.gms.ads.AdRequest.ERROR_CODE_NO_FILL;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
/**
* @author <a href="mailto:jaredsburrows@gmail.com">Jared Burrows</a>
* @since 0.0.1
*/
public class AdUtilsTest {
@Test
public void test_constructor() {
// since there is only 1 static method in the class
AdUtils adUtils = new AdUtils();
assertThat(adUtils, not(nullValue()));
}
@Test
public void test_getErrorReason() {
assertThat(getErrorReason(-1), is("Internal Error"));
assertThat(getErrorReason(ERROR_CODE_INTERNAL_ERROR), is("Internal Error"));
assertThat(getErrorReason(ERROR_CODE_INVALID_REQUEST), is("Invalid Request"));
assertThat(getErrorReason(ERROR_CODE_NETWORK_ERROR), is("Network Error"));
assertThat(getErrorReason(ERROR_CODE_NO_FILL), is("No Fill"));
}
}