1 /* 2 Copyright (c) 2010, 2021, Oracle and/or its affiliates. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 package testsuite.clusterj.util; 26 27 import com.mysql.clusterj.core.util.I18NHelper; 28 import testsuite.clusterj.AbstractClusterJCoreTest; 29 30 public class I18NTest extends AbstractClusterJCoreTest { 31 test()32 public void test() { 33 I18NHelper helper = I18NHelper.getInstance(I18NTest.class); 34 String msg0 = helper.message("MSG_0"); 35 errorIfNotEqual("Failure on message resolution", "Message", msg0); 36 String msg1 = helper.message("MSG_1", 1); 37 errorIfNotEqual("Failure on message resolution", "Message 1", msg1); 38 String msg2 = helper.message("MSG_2", 1, "2"); 39 errorIfNotEqual("Failure on message resolution", "Message 1 2", msg2); 40 String msg3 = helper.message("MSG_3", 1, 2.0, 3); 41 errorIfNotEqual("Failure on message resolution", "Message 1 2 3", msg3); 42 String msg4 = helper.message("MSG_4", 1, 2, 3L, 4); 43 errorIfNotEqual("Failure on message resolution", "Message 1 2 3 4", msg4); 44 String msg5 = helper.message("MSG_5", 1, 2, 3, 4F, 5); 45 errorIfNotEqual("Failure on message resolution", "Message 1 2 3 4 5", msg5); 46 try { 47 String msg6 = helper.message("MSG_6", 1, 2, 3, 4, 5, 6); 48 // bad; should not find MSG_6 in bundle 49 error("Should not find MSG_6 in bundle; returned: " + msg6); 50 } catch (Exception ex) { 51 // good catch 52 } 53 failOnError(); 54 } 55 56 } 57