mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 17:45:50 +01:00
Make sure that every Test class has at least one @Test method, or is abstract
This commit is contained in:
parent
411a90326e
commit
2e91246a45
@ -1,5 +1,7 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.btle;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.test.TestBase;
|
||||
|
||||
public class BtLEQueueTest extends TestBase {
|
||||
@ -14,7 +16,8 @@ public class BtLEQueueTest extends TestBase {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsConnected() throws Exception {
|
||||
|
||||
// TODO
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
@ -11,17 +12,18 @@ import org.robolectric.annotation.Config;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(constants = BuildConfig.class, sdk = 19)
|
||||
// need sdk 19 because "WITHOUT ROWID" is not supported in robolectric/sqlite4java
|
||||
public class TestBase {
|
||||
public abstract class TestBase {
|
||||
protected GBApplication app = (GBApplication) RuntimeEnvironment.application;
|
||||
protected DaoSession daoSession;
|
||||
protected DBHandler dbHandler;
|
||||
@ -29,12 +31,15 @@ public class TestBase {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
assertNotNull(app);
|
||||
|
||||
// doesn't work with Robolectric yet
|
||||
// dbHandler = GBApplication.acquireDB();
|
||||
// daoSession = dbHandler.getDaoSession();
|
||||
DaoMaster.DevOpenHelper openHelper = new DaoMaster.DevOpenHelper(app, null, null);
|
||||
SQLiteDatabase db = openHelper.getWritableDatabase();
|
||||
daoSession = new DaoMaster(db).newSession();
|
||||
assertNotNull(daoSession);
|
||||
}
|
||||
|
||||
@After
|
||||
@ -49,6 +54,4 @@ public class TestBase {
|
||||
return dummyGBDevice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user