aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/statusreporterdelegatetest.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-21 14:32:05 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-25 11:08:43 +0000
commit0ec1dddb0e75c235edfc68d72f4471ad186c3399 (patch)
tree254cdda75b06c8453a207933a8d556c1db90b997 /storage/src/tests/distributor/statusreporterdelegatetest.cpp
parenta0d854b6a3fab6fe44b1164c071fc994b331c3bc (diff)
Convert remaining CppUnit tests to GTest
Move base message sender stub out to common test module to avoid artificial dependency from persistence tests to the distributor tests.
Diffstat (limited to 'storage/src/tests/distributor/statusreporterdelegatetest.cpp')
-rw-r--r--storage/src/tests/distributor/statusreporterdelegatetest.cpp44
1 files changed, 11 insertions, 33 deletions
diff --git a/storage/src/tests/distributor/statusreporterdelegatetest.cpp b/storage/src/tests/distributor/statusreporterdelegatetest.cpp
index 99d576cad56..9e66f1920e2 100644
--- a/storage/src/tests/distributor/statusreporterdelegatetest.cpp
+++ b/storage/src/tests/distributor/statusreporterdelegatetest.cpp
@@ -1,30 +1,16 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vdstestlib/cppunit/macros.h>
#include <tests/common/testhelper.h>
#include <tests/distributor/distributortestutil.h>
-
#include <vespa/storage/distributor/statusreporterdelegate.h>
+#include <vespa/vespalib/gtest/gtest.h>
-namespace storage {
-namespace distributor {
-
-class StatusReporterDelegateTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(StatusReporterDelegateTest);
- CPPUNIT_TEST(testDelegateInvokesDelegatorOnStatusRequest);
- CPPUNIT_TEST_SUITE_END();
-
- void testDelegateInvokesDelegatorOnStatusRequest();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(StatusReporterDelegateTest);
+namespace storage::distributor {
namespace {
-// We really ought to get GoogleMock as part of our testing suite...
-class MockDelegator : public StatusDelegator
-{
+// TODO replace with gmock impl
+class MockDelegator : public StatusDelegator {
mutable std::ostringstream _calls;
bool handleStatusRequest(const DelegatedStatusRequest& request) const override {
_calls << "Request(" << request.path << ")";
@@ -58,30 +44,22 @@ public:
}
-void
-StatusReporterDelegateTest::testDelegateInvokesDelegatorOnStatusRequest()
-{
+TEST(StatusReporterDelegateTest, delegate_invokes_delegator_on_status_request) {
vdstestlib::DirConfig config(getStandardConfig(false));
TestDistributorApp app(config.getConfigId());
MockDelegator mockDelegator;
MockStatusReporter reporter;
- StatusReporterDelegate delegate(app.getComponentRegister(),
- mockDelegator,
- reporter);
+ StatusReporterDelegate delegate(app.getComponentRegister(), mockDelegator, reporter);
framework::HttpUrlPath path("dummy");
- CPPUNIT_ASSERT_EQUAL(vespalib::string("foo/bar"),
- delegate.getReportContentType(path));
+ EXPECT_EQ("foo/bar", delegate.getReportContentType(path));
std::ostringstream ss;
- CPPUNIT_ASSERT(delegate.reportStatus(ss, path));
+ ASSERT_TRUE(delegate.reportStatus(ss, path));
- CPPUNIT_ASSERT_EQUAL(std::string("Request(dummy)"),
- mockDelegator.getCalls());
- CPPUNIT_ASSERT_EQUAL(std::string("reportStatus with dummy"),
- ss.str());
+ EXPECT_EQ("Request(dummy)", mockDelegator.getCalls());
+ EXPECT_EQ("reportStatus with dummy", ss.str());
}
-} // distributor
-} // storage
+} // storage::distributor