AusweisApp2/test/qt/core/paos/test_MessageIdHandler.cpp
2018-03-28 15:10:51 +02:00

45 lines
897 B
C++

/*!
* \copyright Copyright (c) 2014-2018 Governikus GmbH & Co. KG, Germany
*/
#include <QtCore/QtCore>
#include <QtTest/QtTest>
#include "paos/MessageIdHandler.h"
using namespace governikus;
class test_MessageIdHandler
: public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreateNewMsgId()
{
MessageIdHandler handler;
QString myMsgId = handler.createNewMsgId();
QVERIFY(myMsgId.startsWith("urn:uuid:"));
QVERIFY(!QUuid(myMsgId.mid(QString("urn:uuid:").size())).isNull());
QCOMPARE(myMsgId.size(), 9 + 36);
}
void testRemoteMsgId()
{
MessageIdHandler handler;
QString remoteMsgId("123456789");
handler.setRemoteMsgId(remoteMsgId);
QCOMPARE(handler.getRemoteMsgId(), remoteMsgId);
QVERIFY(handler.createNewMsgId().startsWith(QLatin1String("urn:uuid:")));
}
};
QTEST_GUILESS_MAIN(test_MessageIdHandler)
#include "test_MessageIdHandler.moc"