File tree Expand file tree Collapse file tree
main/bookingbugAPI/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package bookingbugAPI .models ;
2+
3+ import helpers .HttpServiceResponse ;
4+
5+ /**
6+ * Created by User on 25.05.2016.
7+ */
8+ public class Note extends BBRoot {
9+
10+ public Note (){}
11+
12+ public Note (HttpServiceResponse httpServiceResponse ) {
13+ super (httpServiceResponse );
14+ }
15+
16+ /**
17+ * Returns the note id.
18+ *
19+ * @return The note id associated with the Note Object
20+ */
21+ public Integer getId () {
22+ return getInteger ("id" , INTEGER_DEFAULT_VALUE );
23+ }
24+
25+ /**
26+ * Returns the note text.
27+ *
28+ * @return The note text associated with the Note Object
29+ */
30+ public String getNote () {
31+ return get ("note" );
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ package bookingbugAPI .models ;
2+
3+ import helpers .HttpServiceResponse ;
4+ import helpers .Utils ;
5+ import org .json .simple .JSONObject ;
6+ import org .junit .After ;
7+ import org .junit .Before ;
8+ import org .junit .Test ;
9+
10+ import java .text .ParseException ;
11+
12+ import static org .junit .Assert .assertTrue ;
13+
14+ /**
15+ * Created by User on 25.05.2016.
16+ */
17+ public class NoteTest extends ModelTest {
18+ private JSONObject jsonObject ;
19+
20+ @ Override
21+ @ Before
22+ public void setUp () {
23+ jsonObject = getJSON ("json/note.json" );
24+ }
25+
26+ @ Override
27+ @ Test
28+ public void modelInit () throws ParseException {
29+ Note note = new Note (new HttpServiceResponse (Utils .stringToContentRep (jsonObject .toString ())));
30+
31+ assertTrue (note .getId ().toString ().equals (jsonObject .get ("id" ).toString ()));
32+ assertTrue (note .getNote ().equals (jsonObject .get ("note" )));
33+ }
34+
35+ @ Override
36+ @ After
37+ public void tearDown () {
38+ jsonObject = null ;
39+ }
40+ }
Original file line number Diff line number Diff line change 1+ {
2+ "id" : 478020 ,
3+ "note" : " "
4+ }
You can’t perform that action at this time.
0 commit comments