714715716717718719720721722723724
assertEquals(123,msg.getInt("prop")); // Long msg = new MapMessageImpl(); msg.setString("prop","123"); msg.markAsReadOnly(); assertEquals(123,msg.getLong("prop")); // Float msg = new MapMessageImpl(); msg.setString("prop","123");
720721722723724725726727728729730
assertEquals(123,msg.getLong("prop")); // Float msg = new MapMessageImpl(); msg.setString("prop","123"); msg.markAsReadOnly(); assertEquals(123,msg.getFloat("prop"),0); // Double msg = new MapMessageImpl(); msg.setString("prop","123");
726727728729730731732733734735736
assertEquals(123,msg.getFloat("prop"),0); // Double msg = new MapMessageImpl(); msg.setString("prop","123"); msg.markAsReadOnly(); assertEquals(123,msg.getDouble("prop"),0); // String msg = new MapMessageImpl(); msg.setString("prop","123");
732733734735736737738739740741742
assertEquals(123,msg.getDouble("prop"),0); // String msg = new MapMessageImpl(); msg.setString("prop","123"); msg.markAsReadOnly(); assertEquals("123",msg.getString("prop")); // Bytes msg = new MapMessageImpl(); msg.setString("prop","123");
738739740741742743744745746747748
assertEquals("123",msg.getString("prop")); // Bytes msg = new MapMessageImpl(); msg.setString("prop","123"); msg.markAsReadOnly(); try { msg.getBytes("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals("123",msg.getString("prop")); } public void testBytesConversion() throws Exception
752753754755756757758759760761762
byte[] dummy = { (byte)1 , (byte)2 , (byte)3 }; // Boolean msg = new MapMessageImpl(); msg.setBytes("prop",dummy); msg.markAsReadOnly(); try { msg.getBoolean("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals(3,msg.getBytes("prop").length); // Byte msg = new MapMessageImpl();
759760761762763764765766767768769
assertEquals(3,msg.getBytes("prop").length); // Byte msg = new MapMessageImpl(); msg.setBytes("prop",dummy); msg.markAsReadOnly(); try { msg.getByte("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals(3,msg.getBytes("prop").length); // Short msg = new MapMessageImpl();
766767768769770771772773774775776
assertEquals(3,msg.getBytes("prop").length); // Short msg = new MapMessageImpl(); msg.setBytes("prop",dummy); msg.markAsReadOnly(); try { msg.getShort("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals(3,msg.getBytes("prop").length); // Char msg = new MapMessageImpl();
773774775776777778779780781782783
assertEquals(3,msg.getBytes("prop").length); // Char msg = new MapMessageImpl(); msg.setBytes("prop",dummy); msg.markAsReadOnly(); try { msg.getChar("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals(3,msg.getBytes("prop").length); // Int msg = new MapMessageImpl();
780781782783784785786787788789790
assertEquals(3,msg.getBytes("prop").length); // Int msg = new MapMessageImpl(); msg.setBytes("prop",dummy); msg.markAsReadOnly(); try { msg.getInt("prop"); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ } assertEquals(3,msg.getBytes("prop").length); // Long msg = new MapMessageImpl();