Skip to content

Commit

Permalink
Fixed Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni Möckel committed Mar 2, 2017
1 parent dcadc34 commit 60df69f
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 89 deletions.
13 changes: 7 additions & 6 deletions lib/QMBForm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ android {
lintOptions {
abortOnError false
}

sourceSets {
androidTest {
setRoot('src/test')
res.srcDirs = [ 'src/test/resources' ]
}


test {
setRoot('src/test')
res.srcDirs = [ 'src/test/resources' ]
Expand All @@ -57,6 +54,9 @@ android {
abortOnError false
}

testOptions {
unitTests.returnDefaultValues = true
}
}

dependencies {
Expand All @@ -65,7 +65,8 @@ dependencies {

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.2.1'
testCompile 'org.robolectric:robolectric:3.0'
testCompile "org.robolectric:robolectric:3.2.2"

}

apply plugin: 'idea'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected void update() {
String title = getFormItemDescriptor().getTitle();
mTextView.setText(title);
mTextView.setVisibility(title == null ? GONE : VISIBLE);
mTextView.setEnabled(!getRowDescriptor().getDisabled());

@SuppressWarnings("unchecked") Value<Date> value = (Value<Date>) getRowDescriptor().getValue();
if (value == null || value.getValue() == null) {
Expand Down Expand Up @@ -79,7 +80,7 @@ public void onDateChanged(Date date) {
// calendar.set(year, monthOfYear, dayOfMonth);
// Date date = new Date(calendar.getTimeInMillis());

updateDateLabel(date, false);
updateDateLabel(date, getRowDescriptor().getDisabled());

onValueChanged(new Value<Date>(date));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -27,7 +27,7 @@
* Created by pmaccamp on 9/14/2015.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class AnnotationFormTest {
private Activity activity;
private TestUserClass testUserClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormBooleanFieldCellTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormButtonFieldCellTest {
private Activity activity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormCheckFieldCellTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -23,7 +23,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormDateFieldCellTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormEditFieldCellTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -21,7 +21,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormIntegerSliderCellTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -21,7 +21,7 @@
* Created by tonimoeckel on 12.08.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormManagerTest {

private FormManager formManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by tonimoeckel on 02.09.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormPickerFieldCellTest {


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

// @Config(constants = BuildConfig.class)
// @RunWith(RobolectricGradleTestRunner.class)
// @RunWith(RobolectricTestRunner.class)
public class ValidationTest {
@Before
public void setUp() {
Expand Down
4 changes: 2 additions & 2 deletions lib/QMBForm/src/test/java/com/quemb/qmbform/ValueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -17,7 +17,7 @@
* Created by tonimoeckel on 28.08.14.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class ValueTest {

private Value<Integer> value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import android.app.Activity;
Expand All @@ -20,7 +20,7 @@
* Created by Toni on 25.10.15.
*/
@Config(constants = BuildConfig.class)
@RunWith(RobolectricGradleTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class FormBaseCellTest {

FormBaseCell cell;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sdk=18
manifest=lib/QMBForm/src/main/AndroidManifest.xml
constants=com.quemb.qmbform.BuildConfig

0 comments on commit 60df69f

Please sign in to comment.