#pragma once
#include <gmock/gmock.h>

#include <Wt/Test/WTestEnvironment>
#include <Wt/WApplication>

class WidgetTest : public testing::Test {
  public:
    WidgetTest() : app(env) {}

    template < typename T >
    T * ut_find(std::string && id) {
        T * item = dynamic_cast< T * >(app.findWidget(id));
        _assert_nut_null(item);
        return item;
    }

  protected:
    Wt::Test::WTestEnvironment env;
    Wt::WApplication app;

  private:
    template < typename T >
    void _assert_nut_null(T * t) {
        ASSERT_TRUE(t != nullptr);
    }
};
