|
| 1 | +/** Copyright (c) 2014 IBM Corp. |
| 2 | + * |
| 3 | + * All rights reserved. This program and the accompanying materials |
| 4 | + * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | + * and Eclipse Distribution License v1.0 which accompany this distribution. |
| 6 | + * |
| 7 | + * The Eclipse Public License is available at |
| 8 | + * http://www.eclipse.org/legal/epl-v10.html |
| 9 | + * and the Eclipse Distribution License is available at |
| 10 | + * http://www.eclipse.org/org/documents/edl-v10.php. |
| 11 | + * |
| 12 | + *******************************************************************************/ |
| 13 | + |
| 14 | +package org.eclipse.paho.client.mqttv3.test.internal; |
| 15 | + |
| 16 | +import java.util.logging.Logger; |
| 17 | + |
| 18 | +import org.eclipse.paho.client.mqttv3.internal.MqttPersistentData; |
| 19 | +import org.eclipse.paho.client.mqttv3.test.logging.LoggingUtilities; |
| 20 | +import org.eclipse.paho.client.mqttv3.test.utilities.Utility; |
| 21 | +import org.junit.AfterClass; |
| 22 | +import org.junit.Assert; |
| 23 | +import org.junit.BeforeClass; |
| 24 | +import org.junit.Test; |
| 25 | + |
| 26 | +/** |
| 27 | + * Tests mqtt topic wildcards |
| 28 | + */ |
| 29 | +public class MqttPersistentDataTest { |
| 30 | + |
| 31 | + static final Class<?> cclass = MqttPersistentDataTest.class; |
| 32 | + private static final String className = cclass.getName(); |
| 33 | + private static final Logger log = Logger.getLogger(className); |
| 34 | + |
| 35 | + @BeforeClass |
| 36 | + public static void setUpBeforeClass() throws Exception { |
| 37 | + String methodName = Utility.getMethodName(); |
| 38 | + LoggingUtilities.banner(log, cclass, methodName); |
| 39 | + } |
| 40 | + |
| 41 | + @AfterClass |
| 42 | + public static void tearDownAfterClass() throws Exception { |
| 43 | + String methodName = Utility.getMethodName(); |
| 44 | + LoggingUtilities.banner(log, cclass, methodName); |
| 45 | + } |
| 46 | + |
| 47 | + @Test |
| 48 | + public void testConstructWithNullPayload() throws Exception { |
| 49 | + byte[] head = new byte[] {1,2,3}; |
| 50 | + MqttPersistentData data = new MqttPersistentData("foo", head, 0, head.length, null, 0, 0); |
| 51 | + Assert.assertArrayEquals("Header data", head, data.getHeaderBytes()); |
| 52 | + Assert.assertNotSame("Header cloned", head, data.getHeaderBytes()); |
| 53 | + } |
| 54 | + |
| 55 | +} |
0 commit comments