javacommons/javastorage/tsrc/java_api/javasrc/com/nokia/mj/impl/storage/TestStorageAttribute.java
changeset 69 773449708c84
parent 21 2a9601315dfc
child 66 2455ef1f5bbc
child 80 d6dafc5d983f
equal deleted inserted replaced
61:bf7ee68962da 69:773449708c84
   134     /**
   134     /**
   135      * Test constructor with name and value.
   135      * Test constructor with name and value.
   136      * 2. Test with Name and Value.
   136      * 2. Test with Name and Value.
   137      * 3. Test Name null throws StorageException
   137      * 3. Test Name null throws StorageException
   138      * 4. Test Name "" throws StorageException
   138      * 4. Test Name "" throws StorageException
   139      * 5. Test value null. Type is not set SE thrown.
   139      * 5. Test value null. It is allowed value.
   140      * 6. Test value "".
   140      * 6. Test value "".
   141      * 7. Test one len name and value.
   141      * 7. Test one len name and value.
   142      * 8. Test value null, type STRING throws StorageException.
   142      * 8. Test value null, type STRING is allowed.
   143      */
   143      */
   144     public void testNameValueConstructor()
   144     public void testNameValueConstructor()
   145     {
   145     {
   146         StorageAttribute sa = new StorageAttribute("N/A", "N/A");
   146         StorageAttribute sa = new StorageAttribute("N/A", "N/A");
   147         // 2. Test with Name and Value
   147         // 2. Test with Name and Value
   193         try
   193         try
   194         {
   194         {
   195             String name = "AttrName";
   195             String name = "AttrName";
   196             String value = null;
   196             String value = null;
   197             sa = new StorageAttribute(name, value);
   197             sa = new StorageAttribute(name, value);
   198             assertTrue("No exp when value Null", false);
   198         }
   199         }
   199         catch (StorageException se)
   200         catch (StorageException se)
   200         {
   201         {
   201             assertTrue("SE thrown when null value: " + se.toString(), false);
   202             // PASSED
       
   203         }
   202         }
   204         catch (Throwable t)
   203         catch (Throwable t)
   205         {
   204         {
   206             assertTrue("Wrong exp thrown: " + t.toString(), false);
   205             assertTrue("Wrong exp thrown: " + t.toString(), false);
   207 
   206 
   244         try
   243         try
   245         {
   244         {
   246             String name = "A";
   245             String name = "A";
   247             String value = null;
   246             String value = null;
   248             sa = new StorageAttribute(name, value);
   247             sa = new StorageAttribute(name, value);
   249             assertTrue("No exp thrown when null value, string type", false);
   248         }
   250         }
   249         catch (StorageException se)
   251         catch (StorageException se)
   250         {
   252         {
   251             assertTrue("SE thrown when null value: " + se.toString(), false);
   253             // PASSED
       
   254         }
   252         }
   255         catch (Throwable t)
   253         catch (Throwable t)
   256         {
   254         {
   257             assertTrue("Wrong exception thrown: " + t.toString(), false);
   255             assertTrue("Wrong exception thrown: " + t.toString(), false);
   258         }
   256         }