/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4957393
* @summary Test that DescriptorSupport.toXMLString() can be used to
* reconstruct an equivalent DescriptorSupport
* @author Eamonn McManus
* @run clean DescriptorSupportXMLTest
* @run build DescriptorSupportXMLTest
* @run main DescriptorSupportXMLTest
*/
public class DescriptorSupportXMLTest {
"can be used to reconstruct an equivalent " +
"DescriptorSupport");
int failed = 0;
final Object[] testValues = {
// Values that should be encodable.
"",
"ok",
"null",
"(open",
"close)",
"(parens)",
"quote\"quote",
"a description with several words",
"magic&\"\\<> \r\t\n\f;&;magic",
"<descriptor>&&&</descriptor>",
"<descriptor>&&&</blahblahblah>",
null,
new Integer(10),
new Float(1.0f),
// Values that are not encodable: it is important that we throw
// an exception during encoding rather than waiting until decode
// time to discover the problem. These classes are not encodable
// because they don't have a (String) constructor.
new Character('!'),
};
final Object v = testValues[i];
(v == null) ? "null" :
final DescriptorSupport in =
try {
} catch (RuntimeOperationsException e) {
if (cause instanceof IllegalArgumentException) {
"RuntimeOperationsException wrapping " +
"an IllegalArgumentException: " +
cause.getMessage());
} else {
final String causeString =
"RuntimeOperationException wrapping " +
failed++;
}
continue;
}
final DescriptorSupport out;
try {
} catch (Exception e) {
failed++;
continue;
}
failed++;
continue;
}
failed++;
continue;
}
if (v == null) {
else {
outValue + "}");
failed++;
}
continue;
}
failed++;
continue;
}
outValue + "}");
failed++;
continue;
}
else {
outValue + "}");
failed++;
}
}
if (failed == 0)
else {
}
}
}