Trying to get some automated tests working....
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(sdk = {Build.VERSION_CODES.O_MR1}, packageName = "uk.org.openseizuredetector")
|
||||
public class LogManagerTest extends TestCase {
|
||||
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
SdData getFakeSdData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWriteToLocalDb() {
|
||||
//SdData sd1 = getFakeSdData();
|
||||
//mLm.writeToLocalDb(sd1);
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
public void testGetDatapointById() {
|
||||
}
|
||||
|
||||
public void testSetDatapointToUploaded() {
|
||||
}
|
||||
|
||||
public void testSetDatapointStatus() {
|
||||
}
|
||||
|
||||
public void testGetDatapointsByDate() {
|
||||
}
|
||||
|
||||
public void testGetEventsList() {
|
||||
}
|
||||
|
||||
public void testPruneLocalDb() {
|
||||
}
|
||||
|
||||
public void testGetNextEventToUpload() {
|
||||
}
|
||||
|
||||
public void testGetNearestDatapointToDate() {
|
||||
}
|
||||
|
||||
public void testGetLocalEventsCount() {
|
||||
}
|
||||
|
||||
public void testGetLocalDatapointsCount() {
|
||||
}
|
||||
|
||||
public void testWriteToRemoteServer() {
|
||||
}
|
||||
|
||||
public void testUploadSdData() {
|
||||
}
|
||||
|
||||
public void testAuthCallback() {
|
||||
}
|
||||
|
||||
public void testFinishUpload() {
|
||||
}
|
||||
|
||||
public void testEventCallback() {
|
||||
}
|
||||
|
||||
public void testUploadNextDatapoint() {
|
||||
}
|
||||
|
||||
public void testDatapointCallback() {
|
||||
}
|
||||
|
||||
public void testClose() {
|
||||
}
|
||||
|
||||
public void testStopRemoteLogTimer() {
|
||||
}
|
||||
|
||||
public void testStopAutoPruneTimer() {
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import java.util.regex.Pattern;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by graham on 01/01/16.
|
||||
*/
|
||||
public class OsdUtilTest {
|
||||
|
||||
@Test
|
||||
public void testIsServerRunning() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartServer() throws Exception {
|
||||
//Activity a = new Activity();
|
||||
Handler handler = new Handler();
|
||||
OsdUtil util = new OsdUtil(null,handler);
|
||||
assertThat(util.isServerRunning(), is(true));
|
||||
assertThat(true, is (true));
|
||||
//assertThat(true, is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStopServer() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class SdAlgHrTest extends TestCase {
|
||||
private SdAlgHr mSdAlgHr = null;
|
||||
|
||||
//@Mock
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private SharedPreferences sharedPrefs;
|
||||
private static PreferenceManager mPreferenceManager;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
//mContext = ApplicationProvider.getApplicationContext();
|
||||
this.sharedPrefs = Mockito.mock(SharedPreferences.class);
|
||||
this.mContext = Mockito.mock(Context.class);
|
||||
mPreferenceManager = Mockito.mock(PreferenceManager.class);
|
||||
//Mockito.when(mContext.getSharedPreferences(anyString(), anyInt())).thenReturn(sharedPrefs);
|
||||
Mockito.when(mPreferenceManager.getDefaultSharedPreferences(any())).thenReturn(sharedPrefs);
|
||||
mSdAlgHr = new SdAlgHr(mContext);
|
||||
assertNotNull(mSdAlgHr);
|
||||
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckHr() throws Exception{
|
||||
setUp();
|
||||
assertNotNull(mSdAlgHr);
|
||||
mSdAlgHr.checkHr(60.);
|
||||
mSdAlgHr.checkHr(70.);
|
||||
mSdAlgHr.checkHr(80.);
|
||||
double hrAv = mSdAlgHr.getAverageHrVal();
|
||||
assertEquals(hrAv, 70);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(sdk = {Build.VERSION_CODES.O_MR1}, packageName = "uk.org.openseizuredetector")
|
||||
public class SdDataTest extends TestCase {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
SdData sd = new SdData();
|
||||
assertTrue(true);
|
||||
|
||||
}
|
||||
|
||||
public void testFromJSON() {
|
||||
}
|
||||
|
||||
public void testTestToString() {
|
||||
}
|
||||
|
||||
public void testToJSON() {
|
||||
}
|
||||
|
||||
public void testToDataString() {
|
||||
}
|
||||
|
||||
public void testToCSVString() {
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class WebApiConnectionTest {
|
||||
WebApiConnection mWac;
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Context context = ApplicationProvider.getApplicationContext();
|
||||
FirebaseApp.initializeApp(context);
|
||||
mWac = new WebApiConnection(context);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isLoggedIn() {
|
||||
assertTrue(mWac.isLoggedIn());
|
||||
assertFalse(mWac.isLoggedIn());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createEvent() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEvent() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEvents() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateEvent() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDatapoint() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUserProfile() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user