1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * @author Alexander V. Esin 20 */ 21 package org.ietf.jgss; 22 23 import junit.framework.TestCase; 24 25 /** 26 * Tests MessageProp class 27 */ 28 public class MessagePropTest extends TestCase { 29 30 public void testGetQOP() { 31 MessageProp mp= new MessageProp(true); 32 int qop= mp.getQOP(); 33 assertEquals(0, qop); 34 } 35 36 public void testGetQOP_0() { 37 MessageProp mp= new MessageProp(10, true); 38 int qop= mp.getQOP(); 39 assertEquals(10, qop); 40 } 41 42 public void testGetQOP_1() { 43 MessageProp mp= new MessageProp(true); 44 mp.setQOP(5); 45 int qop= mp.getQOP(); 46 assertEquals(5, qop); 47 } 48 49 public void testGetQOP_2() { 50 MessageProp mp= new MessageProp(10, true); 51 mp.setQOP(5); 52 int qop= mp.getQOP(); 53 assertEquals(5, qop); 54 } 55 56 public void testGetPrivacy() { 57 MessageProp mp= new MessageProp(true); 58 boolean privacy= mp.getPrivacy(); 59 assertTrue(privacy); 60 } 61 62 public void testGetPrivacy_0() { 63 MessageProp mp= new MessageProp(false); 64 mp.setPrivacy(true); 65 boolean privacy= mp.getPrivacy(); 66 assertTrue(privacy); 67 } 68 69 public void testGetPrivacy_1() { 70 MessageProp mp= new MessageProp(10, true); 71 boolean privacy= mp.getPrivacy(); 72 assertTrue(privacy); 73 } 74 75 public void testGetPrivacy_2() { 76 MessageProp mp= new MessageProp(10, true); 77 mp.setPrivacy(false); 78 boolean privacy= mp.getPrivacy(); 79 assertTrue(!privacy); 80 } 81 82 public void testIsDuplicateToken() { 83 MessageProp mp= new MessageProp(true); 84 boolean d= mp.isDuplicateToken(); 85 assertTrue(!d); 86 } 87 88 public void testIsDuplicateToken_0() { 89 MessageProp mp= new MessageProp(true); 90 mp.setSupplementaryStates(true, false, false, false, 1, "minor string"); 91 boolean d= mp.isDuplicateToken(); 92 assertTrue(d); 93 } 94 95 public void testIsOldToken() { 96 MessageProp mp= new MessageProp(true); 97 boolean d= mp.isOldToken(); 98 assertTrue(!d); 99 } 100 101 public void testIsOldToken_0() { 102 MessageProp mp= new MessageProp(true); 103 mp.setSupplementaryStates(false, true, false, false, 1, "minor string"); 104 boolean d= mp.isOldToken(); 105 assertTrue(d); 106 } 107 108 public void testIsUnseqToken() { 109 MessageProp mp= new MessageProp(true); 110 boolean d= mp.isUnseqToken(); 111 assertTrue(!d); 112 } 113 114 public void testIsUnseqToken_0() { 115 MessageProp mp= new MessageProp(true); 116 mp.setSupplementaryStates(false, false, true, false, 1, "minor string"); 117 boolean d= mp.isUnseqToken(); 118 assertTrue(d); 119 } 120 121 public void testIsGapToken() { 122 MessageProp mp= new MessageProp(true); 123 boolean d= mp.isGapToken(); 124 assertTrue(!d); 125 } 126 127 public void testIsGapToken_0() { 128 MessageProp mp= new MessageProp(true); 129 mp.setSupplementaryStates(false, false, true, true, 1, "minor string"); 130 boolean d= mp.isGapToken(); 131 assertTrue(d); 132 } 133 134 public void testGetMinorStatus() { 135 MessageProp mp= new MessageProp(true); 136 int ms= mp.getMinorStatus(); 137 assertEquals(0, ms); 138 } 139 140 public void testGetMinorStatus_0() { 141 MessageProp mp= new MessageProp(true); 142 mp.setSupplementaryStates(false, false, true, true, 10, "minor string"); 143 int ms= mp.getMinorStatus(); 144 assertEquals(10, ms); 145 } 146 147 public void testGetMinorString() { 148 MessageProp mp= new MessageProp(true); 149 String s= mp.getMinorString(); 150 assertNull(s); 151 } 152 153 public void testGetMinorString_0() { 154 MessageProp mp= new MessageProp(true); 155 mp.setSupplementaryStates(false, false, true, true, 10, "minor string"); 156 String s= mp.getMinorString(); 157 assertEquals("minor string", s); 158 } 159 } 160