File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/net/hexonet/apiconnector
test/java/net/hexonet/apiconnector Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -121,4 +121,17 @@ public boolean isTmpError() {
121
121
String code = (String ) this .hash .get ("CODE" );
122
122
return code .charAt (0 ) == '4' ;
123
123
}
124
+
125
+ /**
126
+ * Check if current operation is returned as pending
127
+ *
128
+ * @return boolean result
129
+ */
130
+ public boolean isPending () {
131
+ String pending = (String ) this .hash .get ("PENDING" );
132
+ if (pending != null ) {
133
+ return pending .equals ("1" );
134
+ }
135
+ return false ;
136
+ }
124
137
}
Original file line number Diff line number Diff line change @@ -66,4 +66,23 @@ public void getRuntime2() {
66
66
"[RESPONSE]\r \n code=423\r \n description=Empty API response\r \n runtime=0.12\r \n EOF\r \n " );
67
67
assertEquals (0.12 , tpl .getRuntime (), 0 );
68
68
}
69
+
70
+ /**
71
+ * Test isPending method #1
72
+ */
73
+ @ Test
74
+ public void isPending1 () {
75
+ ResponseTemplate tpl = new ResponseTemplate ("" );
76
+ assertEquals (false , tpl .isPending ());
77
+ }
78
+
79
+ /**
80
+ * Test isPending method #2
81
+ */
82
+ @ Test
83
+ public void isPending2 () {
84
+ ResponseTemplate tpl = new ResponseTemplate (
85
+ "[RESPONSE]\r \n code=423\r \n description=Empty API response\r \n pending=1\r \n EOF\r \n " );
86
+ assertEquals (true , tpl .isPending ());
87
+ }
69
88
}
You can’t perform that action at this time.
0 commit comments