1 24 25 package org.objectweb.jtests.jms.conform.message.properties; 26 27 import org.objectweb.jtests.jms.framework.*; 28 import javax.jms.*; 29 import junit.framework.*; 30 31 65 public class MessagePropertyConversionTest extends PTPTestCase { 66 67 71 public void testString2String() { 72 try { 73 Message message = senderSession.createMessage(); 74 message.setStringProperty("pi", "3.14159"); 75 assertEquals("3.14159", message.getStringProperty("pi")); 76 } catch (JMSException e) { 77 fail(e); 78 } 79 } 80 81 87 public void testString2Double_2() { 88 try { 89 Message message = senderSession.createMessage(); 90 message.setStringProperty("pi", "not_a_number"); 91 message.getDoubleProperty("pi"); 92 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 93 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 94 } catch (java.lang.NumberFormatException e) { 95 } catch (JMSException e) { 96 fail(e); 97 } 98 } 99 100 105 public void testString2Double_1() { 106 try { 107 Message message = senderSession.createMessage(); 108 message.setStringProperty("pi", "3.14159"); 109 assertEquals(3.14159, message.getDoubleProperty("pi"),0); 110 } catch (JMSException e) { 111 fail(e); 112 } 113 } 114 115 121 public void testString2Float_2() { 122 try { 123 Message message = senderSession.createMessage(); 124 message.setStringProperty("pi", "not_a_number"); 125 message.getFloatProperty("pi"); 126 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 127 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 128 } catch (java.lang.NumberFormatException e) { 129 } catch (JMSException e) { 130 fail(e); 131 } 132 } 133 134 139 public void testString2Float_1() { 140 try { 141 Message message = senderSession.createMessage(); 142 message.setStringProperty("pi", "3.14159"); 143 assertEquals(3.14159F,message.getFloatProperty("pi"), 0); 144 } catch (JMSException e) { 145 fail(e); 146 } 147 } 148 149 155 public void testString2Long_2() { 156 try { 157 Message message = senderSession.createMessage(); 158 message.setStringProperty("pi", "3.14159"); 159 message.getLongProperty("pi"); 160 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 161 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 162 } catch (java.lang.NumberFormatException e) { 163 } catch (JMSException e) { 164 fail(e); 165 } 166 } 167 168 173 public void testString2Long_1() { 174 try { 175 Message message = senderSession.createMessage(); 176 message.setStringProperty("prop", "0"); 177 assertEquals((long)0,message.getLongProperty("prop")); 178 } catch (JMSException e) { 179 fail(e); 180 } 181 } 182 183 189 public void testString2Int_2() { 190 try { 191 Message message = senderSession.createMessage(); 192 message.setStringProperty("pi", "3.14159"); 193 message.getIntProperty("pi"); 194 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 195 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 196 } catch (java.lang.NumberFormatException e) { 197 } catch (JMSException e) { 198 fail(e); 199 } 200 } 201 202 207 public void testString2Int_1() { 208 try { 209 Message message = senderSession.createMessage(); 210 message.setStringProperty("prop", "0"); 211 assertEquals((int)0,message.getIntProperty("prop")); 212 } catch (JMSException e) { 213 fail(e); 214 } 215 } 216 217 223 public void testString2Short_2() { 224 try { 225 Message message = senderSession.createMessage(); 226 message.setStringProperty("pi", "3.14159"); 227 message.getShortProperty("pi"); 228 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 229 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 230 } catch (java.lang.NumberFormatException e) { 231 } catch (JMSException e) { 232 fail(e); 233 } 234 } 235 236 241 public void testString2Short_1() { 242 try { 243 Message message = senderSession.createMessage(); 244 message.setStringProperty("prop", "0"); 245 assertEquals((short)0,message.getShortProperty("prop")); 246 } catch (JMSException e) { 247 fail(e); 248 } 249 } 250 251 257 public void testString2Byte_2() { 258 try { 259 Message message = senderSession.createMessage(); 260 message.setStringProperty("pi", "3.14159"); 261 message.getByteProperty("pi"); 262 fail("�3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + 263 " if the numeric's valueOf() method does not accept the String value as a valid representation.\n"); 264 } catch (java.lang.NumberFormatException e) { 265 } catch (JMSException e) { 266 fail(e); 267 } 268 } 269 270 275 public void testString2Byte_1() { 276 try { 277 Message message = senderSession.createMessage(); 278 message.setStringProperty("prop", "0"); 279 assertEquals((byte)0,message.getByteProperty("prop")); 280 } catch (JMSException e) { 281 fail(e); 282 } 283 } 284 285 291 public void testString2Boolean_2() { 292 try { 293 Message message = senderSession.createMessage(); 294 message.setStringProperty("prop", "test"); 295 assertEquals(false, message.getBooleanProperty("prop")); 296 } catch (MessageFormatException e) { 297 } catch (JMSException e) { 298 fail(e); 299 } 300 } 301 302 307 public void testString2Boolean_1() { 308 try { 309 Message message = senderSession.createMessage(); 310 message.setStringProperty("prop", "true"); 311 assertEquals(true,message.getBooleanProperty("prop")); 312 } catch (JMSException e) { 313 fail(e); 314 } 315 } 316 317 321 public void testDouble2String() { 322 try { 323 Message message = senderSession.createMessage(); 324 message.setDoubleProperty("prop", 127.0); 325 assertEquals("127.0", message.getStringProperty("prop")); 326 } catch (JMSException e) { 327 fail(e); 328 } 329 } 330 331 335 public void testDouble2Double() { 336 try { 337 Message message = senderSession.createMessage(); 338 message.setDoubleProperty("prop", 127.0); 339 assertEquals(127.0, message.getDoubleProperty("prop"), 0); 340 } catch (JMSException e) { 341 fail(e); 342 } 343 } 344 345 349 public void testDouble2Float() { 350 try { 351 Message message = senderSession.createMessage(); 352 message.setDoubleProperty("prop", 127.0); 353 message.getFloatProperty("prop"); 354 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 355 } catch (MessageFormatException e) { 356 } catch (JMSException e) { 357 fail(e); 358 } 359 } 360 361 365 public void testDouble2Long() { 366 try { 367 Message message = senderSession.createMessage(); 368 message.setDoubleProperty("prop", 127.0); 369 message.getLongProperty("prop"); 370 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 371 } catch (MessageFormatException e) { 372 } catch (JMSException e) { 373 fail(e); 374 } 375 } 376 377 381 public void testDouble2Int() { 382 try { 383 Message message = senderSession.createMessage(); 384 message.setDoubleProperty("prop", 127.0); 385 message.getIntProperty("prop"); 386 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 387 } catch (MessageFormatException e) { 388 } catch (JMSException e) { 389 fail(e); 390 } 391 } 392 393 397 public void testDouble2Short() { 398 try { 399 Message message = senderSession.createMessage(); 400 message.setDoubleProperty("prop", 127.0); 402 message.getShortProperty("prop"); 403 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 404 } catch (MessageFormatException e) { 405 } catch (JMSException e) { 406 fail(e); 407 } 408 } 409 410 414 public void testDouble2Byte() { 415 try { 416 Message message = senderSession.createMessage(); 417 message.setDoubleProperty("prop", 127.0); 419 message.getByteProperty("prop"); 420 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 421 } catch (MessageFormatException e) { 422 } catch (JMSException e) { 423 fail(e); 424 } 425 } 426 427 431 public void testDouble2Boolean() { 432 try { 433 Message message = senderSession.createMessage(); 434 message.setDoubleProperty("prop", 127.0); 436 message.getBooleanProperty("prop"); 437 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 438 } catch (MessageFormatException e) { 439 } catch (JMSException e) { 440 fail(e); 441 } 442 } 443 444 448 public void testFloat2String() { 449 try { 450 Message message = senderSession.createMessage(); 451 message.setFloatProperty("prop", 127.0F); 452 assertEquals("127.0", message.getStringProperty("prop")); 453 } catch (JMSException e) { 454 fail(e); 455 } 456 } 457 458 462 public void testFloat2Double() { 463 try { 464 Message message = senderSession.createMessage(); 465 message.setFloatProperty("prop", 127.0F); 466 assertEquals(127.0, message.getDoubleProperty("prop"), 0); 467 } catch (JMSException e) { 468 fail(e); 469 } 470 } 471 472 476 public void testFloat2Float() { 477 try { 478 Message message = senderSession.createMessage(); 479 message.setFloatProperty("prop", 127.0F); 480 assertEquals(127.0F, message.getFloatProperty("prop"), 0); 481 } catch (JMSException e) { 482 fail(e); 483 } 484 } 485 486 490 public void testFloat2Long() { 491 try { 492 Message message = senderSession.createMessage(); 493 message.setFloatProperty("prop", 127.0F); 494 message.getLongProperty("prop"); 495 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 496 } catch (MessageFormatException e) { 497 } catch (JMSException e) { 498 fail(e); 499 } 500 } 501 502 506 public void testFloat2Int() { 507 try { 508 Message message = senderSession.createMessage(); 509 message.setFloatProperty("prop", 127.0F); 510 message.getIntProperty("prop"); 511 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 512 } catch (MessageFormatException e) { 513 } catch (JMSException e) { 514 fail(e); 515 } 516 } 517 518 522 public void testFloat2Short() { 523 try { 524 Message message = senderSession.createMessage(); 525 message.setFloatProperty("prop", 127.0F); 527 message.getShortProperty("prop"); 528 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 529 } catch (MessageFormatException e) { 530 } catch (JMSException e) { 531 fail(e); 532 } 533 } 534 535 539 public void testFloat2Byte() { 540 try { 541 Message message = senderSession.createMessage(); 542 message.setFloatProperty("prop", 127.0F); 544 message.getByteProperty("prop"); 545 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 546 } catch (MessageFormatException e) { 547 } catch (JMSException e) { 548 fail(e); 549 } 550 } 551 552 556 public void testFloat2Boolean() { 557 try { 558 Message message = senderSession.createMessage(); 559 message.setFloatProperty("prop", 127.0F); 561 message.getBooleanProperty("prop"); 562 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 563 } catch (MessageFormatException e) { 564 } catch (JMSException e) { 565 fail(e); 566 } 567 } 568 569 573 public void testLong2String() { 574 try { 575 Message message = senderSession.createMessage(); 576 message.setLongProperty("prop", 127L); 577 assertEquals("127", message.getStringProperty("prop")); 578 } catch (JMSException e) { 579 fail(e); 580 } 581 } 582 583 587 public void testLong2Double() { 588 try { 589 Message message = senderSession.createMessage(); 590 message.setLongProperty("prop", 127L); 591 message.getDoubleProperty("prop"); 592 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 593 } catch (MessageFormatException e) { 594 } catch (JMSException e) { 595 fail(e); 596 } 597 } 598 599 603 public void testLong2Float() { 604 try { 605 Message message = senderSession.createMessage(); 606 message.setLongProperty("prop", 127L); 607 message.getFloatProperty("prop"); 608 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 609 } catch (MessageFormatException e) { 610 } catch (JMSException e) { 611 fail(e); 612 } 613 } 614 615 619 public void testLong2Long() { 620 try { 621 Message message = senderSession.createMessage(); 622 message.setLongProperty("prop", 127L); 623 assertEquals(127L, message.getLongProperty("prop")); 624 } catch (JMSException e) { 625 fail(e); 626 } 627 } 628 629 633 public void testLong2Int() { 634 try { 635 Message message = senderSession.createMessage(); 636 message.setLongProperty("prop", 127L); 637 message.getIntProperty("prop"); 638 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 639 } catch (MessageFormatException e) { 640 } catch (JMSException e) { 641 fail(e); 642 } 643 } 644 645 649 public void testLong2Short() { 650 try { 651 Message message = senderSession.createMessage(); 652 message.setLongProperty("prop", 127L); 654 message.getShortProperty("prop"); 655 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 656 } catch (MessageFormatException e) { 657 } catch (JMSException e) { 658 fail(e); 659 } 660 } 661 662 666 public void testLong2Byte() { 667 try { 668 Message message = senderSession.createMessage(); 669 message.setLongProperty("prop", 127L); 671 message.getByteProperty("prop"); 672 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 673 } catch (MessageFormatException e) { 674 } catch (JMSException e) { 675 fail(e); 676 } 677 } 678 679 683 public void testLong2Boolean() { 684 try { 685 Message message = senderSession.createMessage(); 686 message.setLongProperty("prop", 127L); 688 message.getBooleanProperty("prop"); 689 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 690 } catch (MessageFormatException e) { 691 } catch (JMSException e) { 692 fail(e); 693 } 694 } 695 696 700 public void testInt2String() { 701 try { 702 Message message = senderSession.createMessage(); 703 message.setIntProperty("prop", (int)127); 704 assertEquals("127", message.getStringProperty("prop")); 705 } catch (JMSException e) { 706 fail(e); 707 } 708 } 709 710 714 public void testInt2Double() { 715 try { 716 Message message = senderSession.createMessage(); 717 message.setIntProperty("prop", (int)127); 718 message.getDoubleProperty("prop"); 719 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 720 } catch (MessageFormatException e) { 721 } catch (JMSException e) { 722 fail(e); 723 } 724 } 725 726 730 public void testInt2Float() { 731 try { 732 Message message = senderSession.createMessage(); 733 message.setIntProperty("prop", (int)127); 734 message.getFloatProperty("prop"); 735 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 736 } catch (MessageFormatException e) { 737 } catch (JMSException e) { 738 fail(e); 739 } 740 } 741 742 746 public void testInt2Long() { 747 try { 748 Message message = senderSession.createMessage(); 749 message.setIntProperty("prop", (int)127); 750 assertEquals(127L, message.getLongProperty("prop")); 751 } catch (JMSException e) { 752 fail(e); 753 } 754 } 755 756 760 public void testInt2Int() { 761 try { 762 Message message = senderSession.createMessage(); 763 message.setIntProperty("prop", (int)127); 764 assertEquals((int)127, message.getIntProperty("prop")); 765 } catch (JMSException e) { 766 fail(e); 767 } 768 } 769 770 774 public void testInt2Short() { 775 try { 776 Message message = senderSession.createMessage(); 777 message.setIntProperty("prop", Integer.MAX_VALUE); 779 message.getShortProperty("prop"); 780 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 781 } catch (MessageFormatException e) { 782 } catch (JMSException e) { 783 fail(e); 784 } 785 } 786 787 791 public void testInt2Byte() { 792 try { 793 Message message = senderSession.createMessage(); 794 message.setIntProperty("prop", Integer.MAX_VALUE); 796 message.getByteProperty("prop"); 797 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 798 } catch (MessageFormatException e) { 799 } catch (JMSException e) { 800 fail(e); 801 } 802 } 803 804 808 public void testInt2Boolean() { 809 try { 810 Message message = senderSession.createMessage(); 811 message.setIntProperty("prop", Integer.MAX_VALUE); 813 message.getBooleanProperty("prop"); 814 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 815 } catch (MessageFormatException e) { 816 } catch (JMSException e) { 817 fail(e); 818 } 819 } 820 821 825 public void testShort2String() { 826 try { 827 Message message = senderSession.createMessage(); 828 message.setShortProperty("prop", (short)127); 829 assertEquals("127", message.getStringProperty("prop")); 830 } catch (JMSException e) { 831 fail(e); 832 } 833 } 834 835 839 public void testShort2Double() { 840 try { 841 Message message = senderSession.createMessage(); 842 message.setShortProperty("prop", (short)127); 843 message.getDoubleProperty("prop"); 844 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 845 } catch (MessageFormatException e) { 846 } catch (JMSException e) { 847 fail(e); 848 } 849 } 850 851 855 public void testShort2Float() { 856 try { 857 Message message = senderSession.createMessage(); 858 message.setShortProperty("prop", (short)127); 859 message.getFloatProperty("prop"); 860 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 861 } catch (MessageFormatException e) { 862 } catch (JMSException e) { 863 fail(e); 864 } 865 } 866 867 871 public void testShort2Long() { 872 try { 873 Message message = senderSession.createMessage(); 874 message.setShortProperty("prop", (short)127); 875 assertEquals(127L, message.getLongProperty("prop")); 876 } catch (JMSException e) { 877 fail(e); 878 } 879 } 880 881 885 public void testShort2Int() { 886 try { 887 Message message = senderSession.createMessage(); 888 message.setShortProperty("prop", (short)127); 889 assertEquals((int)127, message.getIntProperty("prop")); 890 } catch (JMSException e) { 891 fail(e); 892 } 893 } 894 895 899 public void testShort2Short() { 900 try { 901 Message message = senderSession.createMessage(); 902 message.setShortProperty("prop", (short)127); 903 assertEquals((short)127, message.getShortProperty("prop")); 904 } catch (JMSException e) { 905 fail(e); 906 } 907 } 908 909 913 public void testShort2Byte() { 914 try { 915 Message message = senderSession.createMessage(); 916 message.setShortProperty("prop", (short)127); 917 message.getByteProperty("prop"); 918 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 919 } catch (MessageFormatException e) { 920 } catch (JMSException e) { 921 fail(e); 922 } 923 } 924 925 929 public void testShort2Boolean() { 930 try { 931 Message message = senderSession.createMessage(); 932 message.setShortProperty("prop", (short)127); 934 message.getBooleanProperty("prop"); 935 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 936 } catch (MessageFormatException e) { 937 } catch (JMSException e) { 938 fail(e); 939 } 940 } 941 942 946 public void testByte2String() { 947 try { 948 Message message = senderSession.createMessage(); 949 message.setByteProperty("prop", (byte)127); 950 assertEquals("127", message.getStringProperty("prop")); 951 } catch (JMSException e) { 952 fail(e); 953 } 954 } 955 956 960 public void testByte2Double() { 961 try { 962 Message message = senderSession.createMessage(); 963 message.setByteProperty("prop", (byte)127); 964 message.getDoubleProperty("prop"); 965 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 966 } catch (MessageFormatException e) { 967 } catch (JMSException e) { 968 fail(e); 969 } 970 } 971 972 976 public void testByte2Float() { 977 try { 978 Message message = senderSession.createMessage(); 979 message.setByteProperty("prop", (byte)127); 980 message.getFloatProperty("prop"); 981 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 982 } catch (MessageFormatException e) { 983 } catch (JMSException e) { 984 fail(e); 985 } 986 } 987 988 992 public void testByte2Long() { 993 try { 994 Message message = senderSession.createMessage(); 995 message.setByteProperty("prop", (byte)127); 996 assertEquals(127L, message.getLongProperty("prop")); 997 } catch (JMSException e) { 998 fail(e); 999 } 1000 } 1001 1002 1006 public void testByte2Int() { 1007 try { 1008 Message message = senderSession.createMessage(); 1009 message.setByteProperty("prop", (byte)127); 1010 assertEquals((int)127, message.getIntProperty("prop")); 1011 } catch (JMSException e) { 1012 fail(e); 1013 } 1014 } 1015 1016 1020 public void testByte2Short() { 1021 try { 1022 Message message = senderSession.createMessage(); 1023 message.setByteProperty("prop", (byte)127); 1024 assertEquals((short)127, message.getShortProperty("prop")); 1025 } catch (JMSException e) { 1026 fail(e); 1027 } 1028 } 1029 1030 1034 public void testByte2Byte() { 1035 try { 1036 Message message = senderSession.createMessage(); 1037 message.setByteProperty("prop", (byte)127); 1038 assertEquals((byte)127, message.getByteProperty("prop")); 1039 } catch (JMSException e) { 1040 fail(e); 1041 } 1042 } 1043 1044 1048 public void testByte2Boolean() { 1049 try { 1050 Message message = senderSession.createMessage(); 1051 message.setByteProperty("prop", (byte)127); 1053 message.getBooleanProperty("prop"); 1054 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1055 } catch (MessageFormatException e) { 1056 } catch (JMSException e) { 1057 fail(e); 1058 } 1059 } 1060 1061 1065 public void testBoolean2String() { 1066 try { 1067 Message message = senderSession.createMessage(); 1068 message.setBooleanProperty("prop", true); 1069 assertEquals("true",message.getStringProperty("prop")); 1070 } catch (JMSException e) { 1071 fail(e); 1072 } 1073 } 1074 1075 1079 public void testBoolean2Double() { 1080 try { 1081 Message message = senderSession.createMessage(); 1082 message.setBooleanProperty("prop", true); 1084 message.getDoubleProperty("prop"); 1085 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1086 } catch (MessageFormatException e) { 1087 } catch (JMSException e) { 1088 fail(e); 1089 } 1090 } 1091 1092 1096 public void testBoolean2Float() { 1097 try { 1098 Message message = senderSession.createMessage(); 1099 message.setBooleanProperty("prop", true); 1101 message.getFloatProperty("prop"); 1102 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1103 } catch (MessageFormatException e) { 1104 } catch (JMSException e) { 1105 fail(e); 1106 } 1107 } 1108 1109 1113 public void testBoolean2Long() { 1114 try { 1115 Message message = senderSession.createMessage(); 1116 message.setBooleanProperty("true", true); 1118 message.getLongProperty("true"); 1119 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1120 } catch (MessageFormatException e) { 1121 } catch (JMSException e) { 1122 fail(e); 1123 } 1124 } 1125 1126 1130 public void testBoolean2Int() { 1131 try { 1132 Message message = senderSession.createMessage(); 1133 message.setBooleanProperty("prop", true); 1135 message.getIntProperty("prop"); 1136 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1137 } catch (MessageFormatException e) { 1138 } catch (JMSException e) { 1139 fail(e); 1140 } 1141 } 1142 1143 1147 public void testBoolean2Short() { 1148 try { 1149 Message message = senderSession.createMessage(); 1150 message.setBooleanProperty("prop", true); 1152 message.getShortProperty("prop"); 1153 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1154 } catch (MessageFormatException e) { 1155 } catch (JMSException e) { 1156 fail(e); 1157 } 1158 } 1159 1160 1164 public void testBoolean2Byte() { 1165 try { 1166 Message message = senderSession.createMessage(); 1167 message.setBooleanProperty("prop", true); 1169 message.getByteProperty("prop"); 1170 fail("�3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); 1171 } catch (MessageFormatException e) { 1172 } catch (JMSException e) { 1173 fail(e); 1174 } 1175 } 1176 1177 1181 public void testBoolean2Boolean() { 1182 try { 1183 Message message = senderSession.createMessage(); 1184 message.setBooleanProperty("prop", true); 1185 assertEquals(true,message.getBooleanProperty("prop")); 1186 } catch (JMSException e) { 1187 fail(e); 1188 } 1189 } 1190 1191 1194 public static Test suite() { 1195 return new TestSuite(MessagePropertyConversionTest.class); 1196 } 1197 1198 public MessagePropertyConversionTest(String name) { 1199 super(name); 1200 } 1201} 1202
| Popular Tags
|