resource: Add test for ConstructResourceObject with InvalidUri
[platform/upstream/iotivity.git] / resource / unittests / OCResourceTest.cpp
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21
22 #include <OCPlatform.h>
23 #include <OCApi.h>
24 #include <gtest/gtest.h>
25 #include <string>
26 #include <map>
27
28 namespace OCResourceTest
29 {
30     using namespace OC;
31     // Callbacks
32     void onObserve(const HeaderOptions, const OCRepresentation&, const int&, const int&)
33     {
34     }
35
36     void onGetPut(const HeaderOptions&, const OCRepresentation& , const int eCode)
37     {
38         EXPECT_EQ(eCode, OC_STACK_OK);
39     }
40
41     void foundResource(std::shared_ptr<OCResource> )
42     {
43     }
44
45     void deleteResponse(const HeaderOptions&, const int)
46     {
47     }
48
49     //Helper method
50     OCResource::Ptr ConstructResourceObject(std::string host, std::string uri)
51     {
52         OCConnectivityType connectivityType = CT_DEFAULT;
53         std::vector<std::string> types = {"intel.rpost"};
54         std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
55
56         auto ret = OCPlatform::constructResourceObject(host, uri,
57                 connectivityType, false, types, ifaces);
58
59         if(!ret)
60         {
61             ADD_FAILURE() << "ConstructResourceObject result was null";
62             throw std::runtime_error("ConstructResourceObject result was null");
63         }
64
65         return ret;
66     }
67
68      //Get Test
69     TEST(ConstructResourceTest, ConstructResourceObject)
70     {
71         EXPECT_ANY_THROW(ConstructResourceObject(std::string(""), std::string("")));
72     }
73
74     TEST(ConstructResourceTest, ConstructResourceObjectWithoutPortNumber)
75     {
76         EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2", "/resource"));
77     }
78
79     TEST(ConstructResourceTest, ConstructResourceObjectInvalidHost)
80     {
81         EXPECT_ANY_THROW(ConstructResourceObject("192.168.1.2:5000", "/resource"));
82     }
83
84     TEST(ConstructResourceTest, ConstructResourceObjectInvalidHost2)
85     {
86         EXPECT_ANY_THROW(ConstructResourceObject("coap://:5000", "/resource"));
87     }
88
89     TEST(ConstructResourceTest, ConstructResourceObjectInvalidUri)
90     {
91         EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2:5000", "/"));
92     }
93
94     TEST(ConstructResourceTest, ConstructResourceObjectInvalidUri2)
95     {
96         EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2:5000", "resource"));
97     }
98
99     TEST(ResourceGetTest, DISABLED_ResourceGetForValidUri)
100     {
101         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
102         EXPECT_TRUE(resource != NULL);
103         EXPECT_EQ(OC_STACK_OK, resource->get(OC::QueryParamsMap(), &onGetPut));
104
105     }
106
107     TEST(ResourceGetTest, DISABLED_ResourceGetForBadUri)
108     {
109         OCResource::Ptr resource = ConstructResourceObject("", "coap://192.168.1.2:5000");
110         EXPECT_TRUE(resource != NULL);
111         EXPECT_THROW(resource->get(OC::QueryParamsMap(), &onGetPut), OC::OCException);
112     }
113
114     TEST(ResourceGetTest, DISABLED_ResourceGetWithHighQos)
115     {
116         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
117         EXPECT_TRUE(resource != NULL);
118         EXPECT_EQ(OC_STACK_OK,
119                 resource->get(OC::QueryParamsMap(), &onGetPut, QualityOfService::HighQos));
120     }
121
122     TEST(ResourceGetTest, DISABLED_ResourceGetWithLowQos)
123     {
124         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
125         EXPECT_TRUE(resource != NULL);
126         EXPECT_EQ(OC_STACK_OK,
127                 resource->get(OC::QueryParamsMap(), &onGetPut, QualityOfService::LowQos));
128     }
129
130     TEST(ResourceGetTest, DISABLED_ResourceGetWithMidQos)
131     {
132         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
133         EXPECT_TRUE(resource != NULL);
134         EXPECT_EQ(OC_STACK_OK,
135                 resource->get(OC::QueryParamsMap(), &onGetPut, QualityOfService::MidQos));
136     }
137
138     TEST(ResourceGetTest, DISABLED_ResourceGetWithNaQos)
139     {
140         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
141         EXPECT_TRUE(resource != NULL);
142         EXPECT_EQ(OC_STACK_OK,
143                 resource->get(OC::QueryParamsMap(), &onGetPut, QualityOfService::NaQos));
144     }
145
146     TEST(ResourceGetTest, DISABLED_ResourceGetWithRTIFNaQos)
147     {
148         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
149         EXPECT_TRUE(resource != NULL);
150         EXPECT_EQ(OC_STACK_OK,
151                 resource->get("", DEFAULT_INTERFACE, QueryParamsMap(), &onGetPut,
152                         QualityOfService::NaQos));
153     }
154
155     TEST(ResourceGetTest, DISABLED_ResourceGetWithNullResourceType)
156     {
157         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
158         EXPECT_TRUE(resource != NULL);
159         EXPECT_ANY_THROW(
160                 resource->get(nullptr, DEFAULT_INTERFACE, QueryParamsMap(), &onGetPut,
161                         QualityOfService::NaQos));
162     }
163
164
165     TEST(ResourceGetTest, DISABLED_ResourceGetWithNullResourceInterface)
166     {
167         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
168         EXPECT_TRUE(resource != NULL);
169         EXPECT_ANY_THROW(
170                 resource->get("", nullptr, QueryParamsMap(), &onGetPut, QualityOfService::NaQos));
171     }
172
173     TEST(ResourceGetTest, DISABLED_ResourceGetWithTypeAndInterface)
174     {
175         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
176         EXPECT_TRUE(resource != NULL);
177         EXPECT_EQ(OC_STACK_OK, resource->get("", DEFAULT_INTERFACE, QueryParamsMap(), &onGetPut));
178     }
179
180     //Post Test
181     TEST(ResourcePostTest, DISABLED_ResourcePostValidConfiguration)
182     {
183         OCRepresentation rep;
184         QueryParamsMap query = {};
185         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
186         EXPECT_TRUE(resource != NULL);
187         EXPECT_EQ(OC_STACK_OK, resource->post(rep, query, &onGetPut));
188     }
189
190     TEST(ResourcePostTest, DISABLED_ResourcePostWithNaQos)
191     {
192         OCRepresentation rep;
193         QueryParamsMap query = {};
194         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
195         EXPECT_TRUE(resource != NULL);
196         EXPECT_EQ(OC_STACK_OK, resource->post(rep, query, &onGetPut, QualityOfService::NaQos));
197     }
198
199     TEST(ResourcePostTest, DISABLED_ResourcePostWithMidQos)
200     {
201         OCRepresentation rep;
202         QueryParamsMap query = {};
203         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
204         EXPECT_TRUE(resource != NULL);
205         EXPECT_EQ(OC_STACK_OK, resource->post(rep, query, &onGetPut, QualityOfService::MidQos));
206     }
207
208     TEST(ResourcePostTest, DISABLED_ResourcePostWithLowQos)
209     {
210         OCRepresentation rep;
211         QueryParamsMap query = {};
212         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
213         EXPECT_TRUE(resource != NULL);
214         EXPECT_EQ(OC_STACK_OK, resource->post(rep, query, &onGetPut, QualityOfService::LowQos));
215     }
216
217     TEST(ResourcePostTest, DISABLED_ResourcePostWithHighQos)
218     {
219         OCRepresentation rep;
220         QueryParamsMap query = {};
221         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
222         EXPECT_TRUE(resource != NULL);
223         EXPECT_EQ(OC_STACK_OK, resource->post(rep, query, &onGetPut, QualityOfService::HighQos));
224     }
225
226     //Put Test
227     TEST(ResourcePutTest, DISABLED_ResourcePutForValid)
228     {
229         OCRepresentation rep;
230         QueryParamsMap query = {};
231         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
232         EXPECT_TRUE(resource != NULL);
233         EXPECT_EQ(OC_STACK_OK, resource->put(rep, query, &onGetPut));
234     }
235
236     TEST(ResourcePutTest, DISABLED_ResourcePutWithNaQos)
237     {
238         OCRepresentation rep;
239         QueryParamsMap query = {};
240         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
241         EXPECT_TRUE(resource != NULL);
242         EXPECT_EQ(OC_STACK_OK, resource->put(rep, query, &onGetPut, QualityOfService::NaQos));
243     }
244
245     TEST(ResourcePutTest, DISABLED_ResourcePutWithLowQos)
246     {
247         OCRepresentation rep;
248         QueryParamsMap query = {};
249         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
250         EXPECT_TRUE(resource != NULL);
251         EXPECT_EQ(OC_STACK_OK, resource->put(rep, query, &onGetPut, QualityOfService::LowQos));
252     }
253
254     TEST(ResourcePutTest, DISABLED_ResourcePutWithMidQos)
255     {
256         OCRepresentation rep;
257         QueryParamsMap query = {};
258         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
259         EXPECT_TRUE(resource != NULL);
260         EXPECT_EQ(OC_STACK_OK, resource->put(rep, query, &onGetPut, QualityOfService::MidQos));
261     }
262
263     TEST(ResourcePutTest, DISABLED_ResourcePutWithHighQos)
264     {
265         OCRepresentation rep;
266         QueryParamsMap query = {};
267         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
268         EXPECT_TRUE(resource != NULL);
269         EXPECT_EQ(OC_STACK_OK, resource->put(rep, query, &onGetPut, QualityOfService::HighQos));
270     }
271
272     TEST(ResourcePutTest, DISABLED_ResourcePutWithTypeAndInterface)
273     {
274         OCRepresentation rep;
275         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
276         EXPECT_TRUE(resource != NULL);
277         EXPECT_EQ(OC_STACK_OK,
278                 resource->put("", DEFAULT_INTERFACE, rep, QueryParamsMap(), &onGetPut));
279     }
280
281     TEST(ResourcePutTest, DISABLED_ResourcePutWithNullType)
282     {
283         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
284         EXPECT_TRUE(resource != NULL);
285         OCRepresentation rep;
286         EXPECT_ANY_THROW(
287                 resource->put(nullptr, DEFAULT_INTERFACE, rep, QueryParamsMap(), &onGetPut));
288         HeaderOptions headerOptions;
289         onGetPut(headerOptions, rep, OC_STACK_OK);
290     }
291
292     TEST(ResourcePutTest, DISABLED_ResourcePutWithNullInterface)
293     {
294         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
295         EXPECT_TRUE(resource != NULL);
296         OCRepresentation rep;
297         EXPECT_ANY_THROW(resource->put("", nullptr, rep, QueryParamsMap(), &onGetPut));
298     }
299
300     // Observer Test
301     TEST(ResourceObserveTest, DISABLED_ResourceObserveValidUri)
302     {
303         OCResource::Ptr resource =
304                 ConstructResourceObject("coap://192.168.1.2:5000", "/Observe");
305         EXPECT_TRUE(resource != NULL);
306         QueryParamsMap query = {};
307         EXPECT_EQ(OC_STACK_OK, resource->observe(ObserveType::ObserveAll, query, &onObserve));
308     }
309
310     TEST(ResourceObserveTest, DISABLED_ResourceObserveLoQos)
311     {
312         QueryParamsMap query = {};
313         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/Observe");
314         EXPECT_TRUE(resource != NULL);
315         EXPECT_EQ(OC_STACK_OK,
316                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
317                         QualityOfService::LowQos));
318     }
319
320     TEST(ResourceObserveTest, DISABLED_ResourceObserveNaQos)
321     {
322         QueryParamsMap query = {};
323         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/Observe");
324         EXPECT_TRUE(resource != NULL);
325         EXPECT_EQ(OC_STACK_OK,
326                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
327                         QualityOfService::NaQos));
328     }
329
330     TEST(ResourceObserveTest, DISABLED_ResourceObserveMidQos)
331     {
332         QueryParamsMap query = {};
333         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/Observe");
334         EXPECT_TRUE(resource != NULL);
335         EXPECT_EQ(OC_STACK_OK,
336                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
337                         QualityOfService::MidQos));
338     }
339
340     TEST(ResourceObserveTest, DISABLED_ResourceObserveHighQos)
341     {
342         QueryParamsMap query = {};
343         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/Observe");
344         EXPECT_TRUE(resource != NULL);
345         EXPECT_EQ(OC_STACK_OK,
346                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
347                         QualityOfService::HighQos));
348     }
349
350     TEST(ResourceObserveTest, DISABLED_ResourceCancelObserveValidUri)
351     {
352         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
353         EXPECT_TRUE(resource != NULL);
354         QueryParamsMap query = {};
355         EXPECT_EQ(OC_STACK_OK, resource->observe(ObserveType::ObserveAll, query, &onObserve));
356         EXPECT_EQ(OC_STACK_OK, resource->cancelObserve());
357     }
358
359     TEST(ResourceObserveTest, DISABLED_ResourceCancelObserveWithNaQos)
360     {
361         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
362         EXPECT_TRUE(resource != NULL);
363         QueryParamsMap query = {};
364         EXPECT_EQ(OC_STACK_OK,
365                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
366                         QualityOfService::NaQos));
367         EXPECT_EQ(OC_STACK_OK, resource->cancelObserve(QualityOfService::NaQos));
368     }
369
370     TEST(ResourceObserveTest, DISABLED_ResourceCancelObserveWithLowQos)
371     {
372         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
373         EXPECT_TRUE(resource != NULL);
374         QueryParamsMap query = {};
375         EXPECT_EQ(OC_STACK_OK,
376                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
377                         QualityOfService::LowQos));
378         EXPECT_EQ(OC_STACK_OK, resource->cancelObserve(QualityOfService::LowQos));
379     }
380
381     TEST(ResourceObserveTest, DISABLED_ResourceCancelObserveWithMidQos)
382     {
383         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
384         EXPECT_TRUE(resource != NULL);
385             QueryParamsMap query = {};
386         EXPECT_EQ(OC_STACK_OK,
387                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
388                         QualityOfService::MidQos));
389         EXPECT_EQ(OC_STACK_OK, resource->cancelObserve(QualityOfService::MidQos));
390     }
391
392     TEST(ResourceObserveTest, DISABLED_ResourceCancelObserveWithHighQos)
393     {
394         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
395         EXPECT_TRUE(resource != NULL);
396             QueryParamsMap query = {};
397         EXPECT_EQ(OC_STACK_OK,
398                 resource->observe(ObserveType::ObserveAll, query, &onObserve,
399                         QualityOfService::HighQos));
400         EXPECT_EQ(OC_STACK_OK, resource->cancelObserve(QualityOfService::HighQos));
401     }
402
403     //DeleteResource
404     TEST(DeleteResourceTest, DISABLED_DeleteResourceValidUri)
405     {
406         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
407         EXPECT_TRUE(resource != NULL);
408         EXPECT_EQ(OC_STACK_OK, resource->deleteResource(&deleteResponse));
409     }
410
411     TEST(DeleteResourceTest, DISABLED_DeleteResourceWithLowQos)
412     {
413         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
414         EXPECT_TRUE(resource != NULL);
415         EXPECT_EQ(OC_STACK_OK,
416                 resource->deleteResource(&deleteResponse, QualityOfService::LowQos));
417     }
418
419     TEST(DeleteResourceTest, DISABLED_DeleteResourceWithMidQos)
420     {
421         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
422         EXPECT_TRUE(resource != NULL);
423         EXPECT_EQ(OC_STACK_OK,
424                 resource->deleteResource(&deleteResponse, QualityOfService::MidQos));
425     }
426
427     TEST(DeleteResourceTest, DISABLED_DeleteResourceWithHighQos)
428     {
429         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
430         EXPECT_TRUE(resource != NULL);
431         EXPECT_EQ(OC_STACK_OK,
432                 resource->deleteResource(&deleteResponse, QualityOfService::HighQos));
433     }
434     TEST(DeleteResourceTest, DISABLED_DeleteResourceWithNaQos)
435     {
436         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
437         EXPECT_TRUE(resource != NULL);
438         EXPECT_EQ(OC_STACK_OK, resource->deleteResource(&deleteResponse, QualityOfService::NaQos));
439     }
440
441     //GetResourceInterfaces Test
442     TEST(GetResourceInterfacesTest, GetResourceInterfaces)
443     {
444         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
445         EXPECT_TRUE(resource != NULL);
446         EXPECT_TRUE(resource->getResourceInterfaces().front() == DEFAULT_INTERFACE);
447     }
448
449     //GetResourceTypes Test
450     TEST(GetResourceTypesTest, GetResourceTypes)
451     {
452         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
453         EXPECT_TRUE(resource != NULL);
454         EXPECT_TRUE(resource->getResourceTypes().front() == "intel.rpost");
455     }
456
457     // Host Test
458     TEST(HostTest, Host)
459     {
460         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
461         EXPECT_TRUE(resource != NULL);
462         EXPECT_TRUE(resource->host() == "coap://192.168.1.2:5000");
463     }
464
465     //Uri Test
466     TEST(UriTest, Uri)
467     {
468         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
469         EXPECT_TRUE(resource != NULL);
470         EXPECT_TRUE(resource->uri() == "/resource");
471     }
472
473     //ConnectivityType Test
474     TEST(ConnectivityTypeTest, ConnectivityType)
475     {
476         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
477         EXPECT_TRUE(resource != NULL);
478         EXPECT_TRUE(resource->connectivityType() == CT_DEFAULT);
479     }
480
481     //IsObservable Test
482     TEST(IsObservableTest, isObservable)
483     {
484         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
485         EXPECT_TRUE(resource != NULL);
486         EXPECT_FALSE(resource->isObservable());
487     }
488
489     //SID Test
490     TEST(SidTest, sid)
491     {
492         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
493         EXPECT_TRUE(resource != NULL);
494         EXPECT_TRUE(resource->sid() == "");
495     }
496
497     //UniqueIdentifier Test
498     TEST(UniqueIdentifierTest, uniqueIdentifier)
499     {
500         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
501         EXPECT_TRUE(resource != NULL);
502         std::ostringstream ss;
503         ss << resource->uniqueIdentifier();
504         EXPECT_TRUE(ss.str() == "/resource");
505     }
506
507     // HeaderOptions Test
508     TEST(HeaderOptionsTest, SetHeaderOptionsValidInput)
509     {
510         const uint16_t API_VERSION = 2048;
511         const uint16_t TOKEN = 3000;
512         HeaderOptions headerOptions;
513         HeaderOption::OCHeaderOption apiVersion(API_VERSION, "v.1.0");
514         HeaderOption::OCHeaderOption clientToken(TOKEN, "21ae43gf");
515         headerOptions.push_back(apiVersion);
516         headerOptions.push_back(clientToken);
517
518         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
519         EXPECT_TRUE(resource != NULL);
520         EXPECT_NO_THROW(resource->setHeaderOptions(headerOptions));
521         EXPECT_NO_THROW(resource->unsetHeaderOptions());
522     }
523
524     TEST(HeaderOptionsTest, SetHeaderOptionsEmptyInput)
525     {
526         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
527         EXPECT_TRUE(resource != NULL);
528         HeaderOptions headerOptions;
529         EXPECT_NO_THROW(resource->setHeaderOptions(headerOptions));
530         EXPECT_NO_THROW(resource->unsetHeaderOptions());
531     }
532 }
533