12
12
#include < thread>
13
13
#include < unity.h>
14
14
#include < user_interaction/IKeypad.hpp>
15
- #include < user_interaction/Menu.hpp>
16
- #include < user_interaction/Presenter.hpp>
15
+ #include < user_interaction/IPresenter.hpp>
17
16
#include < user_interaction/ProcessHmiInputs.hpp>
18
- #include < user_interaction/guiEngine_factory_interface.hpp>
19
17
#include < user_interaction/keypad_factory_interface.hpp>
20
- #include < user_interaction/statusindicators_factory_interface.hpp>
21
18
22
19
using namespace std ::chrono_literals;
23
20
using namespace fakeit ;
24
21
25
22
// mocks
26
23
27
- namespace board
24
+ IPresenter & getFakePresenter ()
28
25
{
29
- IDisplay &getGuiEngine ()
30
- {
31
- Mock<IDisplay> fakeDisplay;
32
- return fakeDisplay.get ();
26
+ static Mock<IPresenter> fakePresenter;
27
+ When (Method (fakePresenter, setTaskStatusIndicator)).AlwaysReturn ();
28
+ return fakePresenter.get ();
33
29
}
34
- } // namespace board
35
30
36
31
namespace serial_port
37
32
{
@@ -55,9 +50,7 @@ void test_Controller()
55
50
Fake (Method (ArduinoFake (), tone));
56
51
57
52
// get collaborator objects
58
- Menu singleMenu (board::getGuiEngine (), board::getKeypad ());
59
- Presenter presenter (singleMenu, board::getStatusIndicators ());
60
- ProcessHmiInputs processor (presenter, board::getKeypad ());
53
+ ProcessHmiInputs processor (getFakePresenter (), board::getKeypad ());
61
54
auto &task1 = std::begin (device::tasks)->second ; // we are going to test for task 1
62
55
63
56
When (Method (ArduinoFake (), digitalRead).Using (board::button::pin::task1)).Return (LOW); // set task 1 button to low
0 commit comments