/* * Copyright (c) 2010 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ /* * Copyright (c) 2015 Tarun Gupta. * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ package com.isode.stroke.serializer.payloadserializers; import static org.junit.Assert.assertEquals; import org.junit.Test; import com.isode.stroke.serializer.payloadserializers.SecurityLabelSerializer; import com.isode.stroke.elements.SecurityLabel; public class SecurityLabelSerializerTest { /** * Default Constructor. */ public SecurityLabelSerializerTest() { } @Test public void testSerialize() { SecurityLabelSerializer testling = new SecurityLabelSerializer(); SecurityLabel securityLabel = new SecurityLabel(); securityLabel.setDisplayMarking("SECRET"); securityLabel.setForegroundColor("black"); securityLabel.setBackgroundColor("red"); securityLabel.setLabel("MQYCAQQGASk="); securityLabel.addEquivalentLabel(""); securityLabel.addEquivalentLabel("MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk="); assertEquals( "" + "SECRET" + "" + "" + "" + "" + "" + "MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=" + "" + "", testling.serialize(securityLabel)); } @Test public void testSerialize_EmptyLabel() { SecurityLabelSerializer testling = new SecurityLabelSerializer(); SecurityLabel securityLabel = new SecurityLabel(); securityLabel.setDisplayMarking("SECRET"); securityLabel.setLabel(""); assertEquals( "" + "SECRET" + "" + "", testling.serialize(securityLabel)); } }