Added unit tests.
[situare] / tests / stubs / messagelistitemstub.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Jussi Laitinen - jussi.laitinen@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef MESSAGELISTITEMSTUB_H
23 #define MESSAGELISTITEMSTUB_H
24
25 #include "../../src/ui/messagelistitem.h"
26 #include "../../src/coordinates/geocoordinate.h"
27 #include "../../src/situareservice/message.h"
28 #include "extendedlistitemstub.h"
29 #include "stubbase.h"
30
31 class MessageListItemStub : public StubBase
32 {
33 public:
34     virtual void MessageListItemConstructor();
35     virtual GeoCoordinate &coordinates() const;
36     virtual QString &id() const;
37     virtual QString &newMessageReceiverId() const;
38     virtual void setNewMessageReceiverId(const QString &newMessageReceiverId);
39     virtual void setMessageData(const Message &message);
40 };
41
42 void MessageListItemStub::MessageListItemConstructor()
43 {
44
45 }
46
47 GeoCoordinate &MessageListItemStub::coordinates() const
48 {
49     return stubReturnValue<GeoCoordinate>("coordinates");
50 }
51
52 QString &MessageListItemStub::id() const
53 {
54     return stubReturnValue<QString>("id");
55 }
56
57 QString &MessageListItemStub::newMessageReceiverId() const
58 {
59     return stubReturnValue<QString>("newMessageReceiverId");
60 }
61
62 void MessageListItemStub::setNewMessageReceiverId(const QString &newMessageReceiverId)
63 {
64     QList<ParameterBase *> params;
65     params.append(new Parameter<const QString &>(newMessageReceiverId));
66     stubMethodEntered("setNewMessageReceiverId", params);
67 }
68
69 void MessageListItemStub::setMessageData(const Message &message)
70 {
71     QList<ParameterBase *> params;
72     params.append(new Parameter<const Message &>(message));
73     stubMethodEntered("setMessageData", params);
74 }
75
76 //Create a stub instance
77 MessageListItemStub defaultMessageListItemStub;
78 MessageListItemStub *messageListItemStub = &defaultMessageListItemStub;
79
80 MessageListItem::MessageListItem()
81     : ExtendedListItem()
82 {
83     messageListItemStub->MessageListItemConstructor();
84 }
85
86 MessageListItem::~MessageListItem()
87 {
88
89 }
90
91 GeoCoordinate &MessageListItem::coordinates() const
92 {
93     return messageListItemStub->coordinates();
94 }
95
96 QString &MessageListItem::id() const
97 {
98     return messageListItemStub->id();
99 }
100
101 QString &MessageListItem::newMessageReceiverId() const
102 {
103     return messageListItemStub->newMessageReceiverId();
104 }
105
106 void MessageListItem::setNewMessageReceiverId(const QString &newMessageReceiverId)
107 {
108     messageListItemStub->setNewMessageReceiverId(newMessageReceiverId);
109 }
110
111 void MessageListItem::setMessageData(const Message &message)
112 {
113     messageListItemStub->setMessageData(message);
114 }
115
116 #endif // MESSAGELISTITEMSTUB_H