javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/AttributeValidatorTest.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   181     public void testMidletVersion()
   181     public void testMidletVersion()
   182     {
   182     {
   183         Hashtable tbl = getTestTbl();
   183         Hashtable tbl = getTestTbl();
   184         String attrName = "MIDlet-Version";
   184         String attrName = "MIDlet-Version";
   185         assertValidValue(tbl, attrName, "1");
   185         assertValidValue(tbl, attrName, "1");
   186         assertValidValue(tbl, attrName, "1.");
   186         assertValidValue(tbl, attrName, "1."); // OPEN: Is this valid? If we are lenient it is.
   187         assertValidValue(tbl, attrName, "1.1");
   187         assertValidValue(tbl, attrName, "1.1");
   188         assertValidValue(tbl, attrName, "1.1.");
   188         assertValidValue(tbl, attrName, "1.1."); // OPEN: Is this valid? If we are lenient it is.
   189         assertValidValue(tbl, attrName, "1.1.1");
   189         assertValidValue(tbl, attrName, "1.1.1");
   190         assertValidValue(tbl, attrName, "1.1:1"); // invalid chars are ignored
       
   191         assertInvalidValue(tbl, attrName, ""); // invalid, attr is mandatory
   190         assertInvalidValue(tbl, attrName, ""); // invalid, attr is mandatory
   192         assertInvalidValue(tbl, attrName, " "); // invalid, attr is mandatory
   191         assertInvalidValue(tbl, attrName, " "); // invalid, attr is mandatory
       
   192         assertInvalidValue(tbl, attrName, "1.1:1"); // invalid char
   193         assertInvalidValue(tbl, attrName, "1.1.1."); // invalid, only three parts allowed
   193         assertInvalidValue(tbl, attrName, "1.1.1."); // invalid, only three parts allowed
   194         assertInvalidValue(tbl, attrName, "1.1.1.1"); // invalid, only three parts allowed
   194         assertInvalidValue(tbl, attrName, "1.1.1.1"); // invalid, only three parts allowed
   195         assertInvalidValue(tbl, attrName, "abc"); // invalid, version is mandatory
   195         assertInvalidValue(tbl, attrName, "abc"); // invalid chars
   196     }
   196     }
   197 
   197 
   198     public void testRuntimeExecutionEnvironment()
   198     public void testRuntimeExecutionEnvironment()
   199     {
   199     {
   200         Hashtable tbl = getTestTbl();
   200         Hashtable tbl = getTestTbl();