use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class SecureClassLoaderTest method testSecureClassLoaderClassLoader.
@KnownFailure("Android doesn't allow null parent.")
public void testSecureClassLoaderClassLoader() throws Exception {
URL[] urls = new URL[] { new URL("http://localhost") };
URLClassLoader ucl = URLClassLoader.newInstance(urls);
new MyClassLoader(ucl);
try {
new MyClassLoader(null);
} catch (Exception e) {
fail("unexpected exception: " + e);
}
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class SignatureTest method testUpdatebyteArrayintint2.
/*
* Class under test for void update(byte[], int, int)
*/
@KnownFailure("Android throws IllegalArgumentException, RI throws NullpointerException")
public void testUpdatebyteArrayintint2() throws Exception {
MySignature1 s = new MySignature1("ABC");
byte[] b = { 1, 2, 3, 4 };
s.initVerify(new MyPublicKey());
s.update(b, 0, 3);
s.initSign(new MyPrivateKey());
s.update(b, 0, 3);
assertEquals("state", MySignature1.SIGN, s.getState());
assertTrue("update() failed", s.runEngineUpdate2);
try {
s.update(null, 0, 3);
fail("NullPointerException wasn't thrown");
} catch (NullPointerException npe) {
// ok
}
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class ResourceBundleTest method test_getBundleLjava_lang_StringLjava_util_LocaleLjava_lang_ClassLoader.
/**
* java.util.ResourceBundle#getBundle(java.lang.String,
* java.util.Locale, java.lang.ClassLoader)
*/
@KnownFailure("It's not allowed to pass null as parent class loader to" + " a new ClassLoader anymore. Maybe we need to change" + " URLClassLoader to allow this? It's not specified.")
public void test_getBundleLjava_lang_StringLjava_util_LocaleLjava_lang_ClassLoader() {
String classPath = System.getProperty("java.class.path");
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
Vector<URL> urlVec = new Vector<URL>();
String resPackage = Support_Resources.RESOURCE_PACKAGE;
try {
while (tok.hasMoreTokens()) {
String path = tok.nextToken();
String url;
if (new File(path).isDirectory())
url = "file:" + path + resPackage + "subfolder/";
else
url = "jar:file:" + path + "!" + resPackage + "subfolder/";
urlVec.addElement(new URL(url));
}
} catch (MalformedURLException e) {
}
URL[] urls = new URL[urlVec.size()];
for (int i = 0; i < urlVec.size(); i++) urls[i] = urlVec.elementAt(i);
URLClassLoader loader = new URLClassLoader(urls, null);
String name = Support_Resources.RESOURCE_PACKAGE_NAME + ".hyts_resource";
ResourceBundle bundle = ResourceBundle.getBundle(name, Locale.getDefault());
assertEquals("Wrong value read", "parent", bundle.getString("property"));
bundle = ResourceBundle.getBundle(name, Locale.getDefault(), loader);
assertEquals("Wrong cached value", "resource", bundle.getString("property"));
try {
ResourceBundle.getBundle(null, Locale.getDefault(), loader);
fail("NullPointerException expected");
} catch (NullPointerException ee) {
//expected
}
try {
ResourceBundle.getBundle(name, null, loader);
fail("NullPointerException expected");
} catch (NullPointerException ee) {
//expected
}
try {
ResourceBundle.getBundle(name, Locale.getDefault(), (ClassLoader) null);
fail("NullPointerException expected");
} catch (NullPointerException ee) {
//expected
}
try {
ResourceBundle.getBundle("", Locale.getDefault(), loader);
fail("MissingResourceException expected");
} catch (MissingResourceException ee) {
//expected
}
// Regression test for Harmony-3823
B bb = new B();
String s = bb.find("nonexistent");
s = bb.find("name");
assertEquals("Wrong property got", "Name", s);
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class SAXParserFactoryTest method test_newInstance.
@KnownFailure("Dalvik doesn't honor system properties when choosing a SAX implementation")
public void test_newInstance() {
try {
SAXParserFactory dtf = SAXParserFactory.newInstance();
assertNotNull("New Instance of DatatypeFactory is null", dtf);
System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.harmony.xml.parsers.SAXParserFactoryImpl");
SAXParserFactory spf1 = SAXParserFactory.newInstance();
assertTrue(spf1 instanceof org.apache.harmony.xml.parsers.SAXParserFactoryImpl);
String key = "javax.xml.parsers.SAXParserFactory = org.apache.harmony.xml.parsers.SAXParserFactoryImpl";
ByteArrayInputStream bis = new ByteArrayInputStream(key.getBytes());
Properties prop = System.getProperties();
prop.load(bis);
SAXParserFactory spf2 = SAXParserFactory.newInstance();
assertTrue(spf2 instanceof org.apache.harmony.xml.parsers.SAXParserFactoryImpl);
System.setProperty("javax.xml.parsers.SAXParserFactory", "");
try {
SAXParserFactory.newInstance();
fail("Expected FactoryConfigurationError was not thrown");
} catch (FactoryConfigurationError e) {
// expected
}
} catch (IOException ioe) {
fail("Unexpected exception " + ioe.toString());
}
}
Aggregations