summaryrefslogtreecommitdiff
path: root/src/test/DBusClientIdTest.cpp
blob: b21aeb9e76974c84c31c05a1a238388ff41d5abc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Copyright (C) 2013 BMW Group
 * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
 * Author: Juergen Gehring (juergen.gehring@bmw.de)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <gtest/gtest.h>

#include "CommonAPI/DBus/DBusClientId.h"
#include "CommonAPI/types.h"

using namespace CommonAPI::DBus;

class DBusClientIdTest: public ::testing::Test {

public:
    void SetUp() {

    }

    void TearDown() {

    }
};

class TestClientId: public CommonAPI::ClientId {
public:
    bool operator==(CommonAPI::ClientId& clientIdToCompare) {
        return false; // doesn't matter, as we are just comparing this class with DBusClientId;
    }

    std::size_t hashCode() {
        return 0;
    }

};

TEST_F(DBusClientIdTest, TestClientIdImplementation) {
    DBusClientId dbusId1("test1");
    DBusClientId dbusId2("test2");
    TestClientId testId;


    ASSERT_TRUE(dbusId1 == dbusId1);
    ASSERT_FALSE(dbusId1 == dbusId2);
    ASSERT_FALSE(dbusId2 == dbusId1);

    ASSERT_FALSE(dbusId1 == testId);
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}