blob: 576f82d6f4c7d1eadf57cc4ae1ba5ca737a1d496 [file] [log] [blame]
* Copyright (c) 2014-2015 IBM Corp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* Allan Stockdill-Mander - initial API and implementation
package packets
import (
func TestSubscribeStruct(t *testing.T) {
msg := NewMessage(SUBSCRIBE).(*SubscribeMessage)
if assert.NotNil(t, msg, "New message should not be nil") {
assert.Equal(t, "*packets.SubscribeMessage", reflect.TypeOf(msg).String(), "Type should be SubscribeMessage")
assert.Equal(t, false, msg.Dup, "Default Dup flag should be false")
assert.Equal(t, 0, msg.Qos, "Default Qos should be 0")
assert.Equal(t, 0, msg.TopicIdType, "Default TopicIdType should be 0")
assert.Equal(t, 0, msg.TopicId, "Default TopicId should be 0")
assert.Equal(t, 0, msg.MessageId, "Default MessageId should be 0")
assert.Equal(t, []byte(nil), msg.TopicName, "Default Topicname should be blank")
assert.Equal(t, SUBSCRIBE, msg.MessageType(), "MessageType() should return SUBSCRIBE")