5860N/A/*
5860N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5860N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5860N/A *
5860N/A * This code is free software; you can redistribute it and/or modify it
5860N/A * under the terms of the GNU General Public License version 2 only, as
5860N/A * published by the Free Software Foundation.
5860N/A *
5860N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5860N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5860N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5860N/A * version 2 for more details (a copy is included in the LICENSE file that
5860N/A * accompanied this code).
5860N/A *
5860N/A * You should have received a copy of the GNU General Public License version
5860N/A * 2 along with this work; if not, write to the Free Software Foundation,
5860N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5860N/A *
5860N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5860N/A * or visit www.oracle.com if you need additional information or have any
5860N/A * questions.
5860N/A */
5860N/A
5860N/A/**
5860N/A * Check that the value of file.encoding and sun.jnu.encoding match the expected
5860N/A * values passed in on the command-line.
5860N/A */
5860N/Apublic class ExpectedEncoding {
5860N/A public static void main(String[] args) {
5860N/A boolean failed = false;
5860N/A if (args.length != 2) {
5860N/A System.out.println("Usage:");
5860N/A System.out.println("$ java ExpectedEncoding <expected file.encoding> <expected sun.jnu.encoding>");
5860N/A System.exit(1);
5860N/A }
5860N/A String expectFileEnc = args[0];
5860N/A String expectSunJnuEnc = args[1];
5860N/A
5860N/A String fileEnc = System.getProperty("file.encoding");
5860N/A String jnuEnc = System.getProperty("sun.jnu.encoding");
5860N/A
5860N/A if (fileEnc == null || !fileEnc.equals(expectFileEnc)) {
5860N/A System.err.println("Expected file.encoding: " + expectFileEnc);
5860N/A System.err.println("Actual file.encoding: " + fileEnc);
5860N/A failed = true;
5860N/A }
5860N/A if (jnuEnc == null || !jnuEnc.equals(expectSunJnuEnc)) {
5860N/A System.err.println("Expected sun.jnu.encoding: " + expectSunJnuEnc);
5860N/A System.err.println("Actual sun.jnu.encoding: " + jnuEnc);
5860N/A failed = true;
5860N/A }
5860N/A if (failed) {
5860N/A throw new RuntimeException("Test Failed");
5860N/A }
5860N/A }
5860N/A}