This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RELEASE]merging 'release-1.9' into 'master'
- Loading branch information
Showing
7 changed files
with
186 additions
and
83 deletions.
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
...del/src/main/java/org/ccem/otus/survey/template/item/surveyitemgroup/SurveyItemGroup.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,11 @@ | ||
package org.ccem.otus.survey.template.item.surveyitemgroup; | ||
|
||
|
||
import java.util.List; | ||
|
||
public class SurveyItemGroup { | ||
public String objectType; | ||
public String start; | ||
public String end; | ||
public List<SurveyItemGroupMember> members; | ||
} |
6 changes: 6 additions & 0 deletions
6
...c/main/java/org/ccem/otus/survey/template/item/surveyitemgroup/SurveyItemGroupMember.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,6 @@ | ||
package org.ccem.otus.survey.template.item.surveyitemgroup; | ||
|
||
public class SurveyItemGroupMember { | ||
public String id; | ||
public String position; | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...st/java/org/ccem/otus/survey/template/item/surveyitemgroup/SurveyItemGroupMemberTest.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,33 @@ | ||
package org.ccem.otus.survey.template.item.surveyitemgroup; | ||
|
||
import com.google.gson.Gson; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.powermock.modules.junit4.PowerMockRunner; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@RunWith(PowerMockRunner.class) | ||
public class SurveyItemGroupMemberTest { | ||
private SurveyItemGroupMember surveyItemGroupMember; | ||
|
||
@Before | ||
public void setUp() { | ||
String json = "" | ||
+ "{\"id\": \"DIC1\"," | ||
+ "\"position\": \"start\"}"; | ||
|
||
surveyItemGroupMember = new Gson().fromJson(json, SurveyItemGroupMember.class); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_id_attribute(){ | ||
assertEquals("DIC1",surveyItemGroupMember.id); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_position_attribute(){ | ||
assertEquals("start",surveyItemGroupMember.position); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...src/test/java/org/ccem/otus/survey/template/item/surveyitemgroup/SurveyItemGroupTest.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,49 @@ | ||
package org.ccem.otus.survey.template.item.surveyitemgroup; | ||
|
||
import com.google.gson.Gson; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.powermock.modules.junit4.PowerMockRunner; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(PowerMockRunner.class) | ||
public class SurveyItemGroupTest { | ||
private SurveyItemGroup surveyItemGroup; | ||
|
||
@Before | ||
public void setUp() { | ||
String json = "" | ||
+ "{\"objectType\": \"SurveyItemGroup\"," | ||
+ "\"start\": \"DIC1\"," | ||
+ "\"end\": \"DIC3\"," | ||
+ "\"members\":[]}"; | ||
|
||
surveyItemGroup = new Gson().fromJson(json, SurveyItemGroup.class); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_objectType_attribute(){ | ||
assertEquals("SurveyItemGroup",surveyItemGroup.objectType); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_start_attribute(){ | ||
assertEquals("DIC1",surveyItemGroup.start); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_end_attribute(){ | ||
assertEquals("DIC3",surveyItemGroup.end); | ||
} | ||
|
||
@Test | ||
public void should_parse_correctly_members_attribute(){ | ||
assertTrue(surveyItemGroup.members instanceof List<?>); | ||
} | ||
} |