summaryrefslogtreecommitdiff
path: root/unotest/source/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unotest/source/cpp')
-rw-r--r--unotest/source/cpp/macros_test.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx
index 81738dc6dafe..f30cbcdac3ea 100644
--- a/unotest/source/cpp/macros_test.cxx
+++ b/unotest/source/cpp/macros_test.cxx
@@ -172,14 +172,16 @@ void MacrosTest::tearDownNssGpg()
#endif
}
+bool MacrosTest::IsValid(const css::uno::Reference<css::security::XCertificate>& cert)
+{
+ return DateTime(DateTime::SYSTEM)
+ .IsBetween(cert->getNotValidBefore(), cert->getNotValidAfter());
+}
+
css::uno::Reference<css::security::XCertificate> MacrosTest::GetValidCertificate(
const css::uno::Sequence<css::uno::Reference<css::security::XCertificate>>& certs)
{
- auto it
- = std::find_if(certs.begin(), certs.end(), [now = DateTime(DateTime::SYSTEM)](auto& xCert) {
- return now.IsBetween(xCert->getNotValidBefore(), xCert->getNotValidAfter());
- });
- if (it != certs.end())
+ if (auto it = std::find_if(certs.begin(), certs.end(), IsValid); it != certs.end())
return *it;
return {};
}