New Commit with testing files updated

This commit is contained in:
2019-02-23 16:18:49 +11:00
parent c1dc1ee96e
commit 8890686424
6 changed files with 64 additions and 6 deletions

Binary file not shown.

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.appttude.h_mal.easycc"
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 27
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -17,14 +17,18 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}

View File

@@ -0,0 +1,36 @@
package com.appttude.h_mal.easycc;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.*;
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> activityActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class);
private MainActivity mainActivity = null;
@Before
public void setUp() throws Exception {
mainActivity = activityActivityTestRule.getActivity();
}
@Test
public void testViews(){
View view = mainActivity.findViewById(R.id.editText);
assertNotNull(view);
}
@After
public void TearDown() throws Exception{
mainActivity = null;
}
}

View File

@@ -24,8 +24,6 @@ public class PublicMethods {
s1 = s1.substring(0,3);
s2 = s2.substring(0,3);
Log.i(TAG, "UriBuilder: " + s1 + "_" + s2);
Uri baseUri = Uri.parse(URL);
Uri.Builder builder = baseUri.buildUpon();
builder.appendQueryParameter("q", s1 + "_" + s2)

View File

@@ -1,7 +1,18 @@
package com.appttude.h_mal.easycc;
import android.content.Context;
import android.content.res.Resources;
import android.os.AsyncTask;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import static com.appttude.h_mal.easycc.PublicMethods.UriBuilder;
import static com.appttude.h_mal.easycc.PublicMethods.createUrl;
import static com.appttude.h_mal.easycc.PublicMethods.makeHttpRequest;
import static org.junit.Assert.*;
/**
@@ -10,8 +21,11 @@ import static org.junit.Assert.*;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}