-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
534 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
opensrp-core/src/test/java/org/smartregister/clientandeventmodel/SubFormDataTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.smartregister.clientandeventmodel; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.smartregister.BaseUnitTest; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class SubFormDataTest extends BaseUnitTest { | ||
|
||
@Test | ||
public void testConstructorNotNull1() { | ||
List<Map<String, String>> instanceList = new ArrayList<>(); | ||
Map<String, String> dataMap = new HashMap<>(); | ||
dataMap.put("key", "value"); | ||
instanceList.add(dataMap); | ||
Assert.assertNotNull(new SubFormData("name", instanceList)); | ||
|
||
} | ||
|
||
@Test | ||
public void testFieldsNotNull() { | ||
List<FormField> formFields = new ArrayList<>(); | ||
FormField field = new FormField(); | ||
formFields.add(field); | ||
SubFormData data = new SubFormData(); | ||
data.setFields(formFields); | ||
Assert.assertNotNull(data); | ||
Assert.assertNotNull(data.fields()); | ||
|
||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
opensrp-core/src/test/java/org/smartregister/domain/form/FormFieldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.smartregister.domain.form; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.smartregister.BaseUnitTest; | ||
|
||
public class FormFieldTest extends BaseUnitTest { | ||
|
||
@Test | ||
public void testEqualsShouldReturnTrueForIdenticalObjects() { | ||
FormField formField1 = new FormField("name", "value", "source"); | ||
FormField formField2 = new FormField("name", "value", "source"); | ||
Assert.assertTrue(formField1.equals(formField2)); | ||
} | ||
|
||
@Test | ||
public void testHashCodeNotNull() { | ||
FormField formField = new FormField("name", "value", "source"); | ||
Assert.assertNotNull(formField.hashCode()); | ||
} | ||
|
||
@Test | ||
public void testToStringShouldReturnCorrectData() { | ||
FormField formField = new FormField("name", "value", "source"); | ||
Assert.assertNotNull(formField.toString()); | ||
} | ||
|
||
@Test | ||
public void testSettersShouldSetCorrectValue() { | ||
FormField formField = new FormField("n", "v", "s"); | ||
formField.setName("name"); | ||
formField.setValue("value"); | ||
formField.setSource("source"); | ||
Assert.assertEquals("name", formField.getName()); | ||
Assert.assertEquals("value", formField.value()); | ||
Assert.assertEquals("source", formField.source()); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.