@@ -0,0 +1,2284 @@
+/* Copyright (c) 2014, Yubico AB.  All rights reserved.%0A%0A   Redistribution and use in source and binary forms, with or without%0A   modification, are permitted provided that the following conditions%0A   are met:%0A%0A   * Redistributions of source code must retain the above copyright%0A     notice, this list of conditions and the following disclaimer.%0A%0A   * Redistributions in binary form must reproduce the above copyright%0A     notice, this list of conditions and the following%0A     disclaimer in the documentation and/or other materials provided%0A     with the distribution.%0A%0A   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND%0A   CONTRIBUTORS %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES,%0A   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF%0A   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS%0A   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,%0A   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED%0A   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON%0A   ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR%0A   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF%0A   THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF%0A   SUCH DAMAGE.%0A*/%0A%0Apackage com.yubico.base.test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport com.yubico.base.Configurator;%0A%0Apublic class ConfiguratorTest %7B%0A%09Configurator cfg;%0A%09%0A%09@Before%0A%09public void setup() %7B%0A%09%09cfg = new Configurator();%0A%09%7D%0A%09@Test%0A%09public void testStructure() %7B%0A%09%09cfg.setFixed(new byte%5B%5D %7B0x01, 0x02, 0x03, 0x04, 0x05, 0x06%7D);%0A%09%09cfg.setUid(new byte%5B%5D %7B0x11, 0x12, 0x13, 0x14, 0x15, 0x16%7D);%0A%09%09cfg.setKey(Configurator.AES_MODE, new byte%5B%5D %7B0x20, 0x21, 0x22, 0x23, 0x24, 0x25,%0A%09%09%09%090x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f%7D);%0A%09%09cfg.setTktFlags(Configurator.TKTFLAG_APPEND_CR);%0A%09%09byte%5B%5D config = cfg.getConfigStructure();%0A%09%09%0A%09%09assertEquals(58, config.length);%0A%09%7D%0A%09%0A%09@SuppressWarnings(%22unused%22)%0A%09private void dumpHex(byte%5B%5D bytes) %7B%0A%09%09String out = %22%22;%0A%09%09for(byte b : bytes) %7B%0A%09%09%09out += String.format(%22%2502x%22, b);%0A%09%09%7D%0A%09%09System.out.println(out);%0A%09%7D%0A%7D%0A

add a test of the Configurator class