1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include "UnitTestHelper.h"
23 #include "RCSResponse.h"
24 #include "RCSSeparateResponse.h"
25 #include "RCSException.h"
27 using namespace OIC::Service;
29 TEST(RCSResponseTest, DefaultSetResponseHasDefaultMethod)
31 EXPECT_EQ(RCSSetResponse::AcceptanceMethod::DEFAULT,
32 RCSSetResponse::defaultAction().getAcceptanceMethod());
35 TEST(RCSResponseTest, AcceptSetResponseHasAcceptMethod)
37 EXPECT_EQ(RCSSetResponse::AcceptanceMethod::ACCEPT,
38 RCSSetResponse::accept().getAcceptanceMethod());
41 TEST(RCSResponseTest, IgnoreSetResponseHasIgnoreMethod)
43 EXPECT_EQ(RCSSetResponse::AcceptanceMethod::IGNORE,
44 RCSSetResponse::ignore().getAcceptanceMethod());
47 TEST(RCSResponseTest, SetResponseHasMethodSetBySetter)
49 RCSSetResponse::AcceptanceMethod method = RCSSetResponse::AcceptanceMethod::ACCEPT;
50 RCSSetResponse response =
51 RCSSetResponse::defaultAction().setAcceptanceMethod(method);
53 EXPECT_EQ(method, response.getAcceptanceMethod());
56 TEST(RCSResponseTest, SeparateResponseHasNoHandler)
58 RCSGetResponse response = RCSGetResponse::separate();
59 EXPECT_EQ(nullptr, response.getHandler());
62 TEST(RCSResponseTest, ThrowIfRequestIsInvalidWhenConstructingSeparateResponse)
66 EXPECT_THROW(RCSSeparateResponse resp(aRequest), RCSInvalidParameterException);