Skip to content

Commit

Permalink
Update 4.09 to new testing scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Silver committed Nov 7, 2016
1 parent fca1e53 commit bd16bb0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
5 changes: 4 additions & 1 deletion 4.09-Demo-AndroidUnitTesting/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

productFlavors {
Expand All @@ -53,6 +53,9 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
testCompile 'junit:junit:4.12'
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package com.udacity.gradle.testing;

import android.test.AndroidTestCase;
import android.support.test.runner.AndroidJUnit4;

public class EchoAndroidTest extends AndroidTestCase {
import org.junit.Test;
import org.junit.runner.RunWith;

import static junit.framework.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
public class EchoAndroidTest {

@Test
public void testVerifyEchoResponse() {
assertEquals("hello", Echo.echo("hello"));
}

@Test
public void testVerifyLoggingEchoResponse() {
assertEquals("hello", Echo.echo("hello", true));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
package com.udacity.gradle.testing;

import android.test.AndroidTestCase;
import android.support.test.runner.AndroidJUnit4;

import com.udacity.gradle.testing.paid.PaidEcho;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Collection;

public class PaidEchoAndroidTest extends AndroidTestCase {
import static junit.framework.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
public class PaidEchoAndroidTest {

@Test
public void testVerifyEchoResponse() {
assertEquals("hello", Echo.echo("hello"));
}

@Test
public void testVerifyLoggingEchoResponse() {
Collection<String> strings = PaidEcho.echo("hello", 10, true);
assertEquals(strings.size(), 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.Collection;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

public class PaidEchoTest {
@Test
Expand Down
2 changes: 1 addition & 1 deletion 4.09-Demo-AndroidUnitTesting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
classpath 'com.android.tools.build:gradle:2.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit bd16bb0

Please sign in to comment.