Code example for Attributes

Methods: get

0
    public void test_getAttributes() throws Exception { 
        URL u = createContent("lf.jar", "swt.dll");
        juc = (JarURLConnection) u.openConnection();
        java.util.jar.Attributes a = juc.getAttributes();
        assertEquals("Returned incorrect Attributes", "SHA MD5", a
                .get(new java.util.jar.Attributes.Name("Digest-Algorithms")));
        URL invURL = createContent("InvalidJar.jar", "Test.class");
 
        JarURLConnection juConn = (JarURLConnection) invURL.openConnection();
        try { 
            juConn.getAttributes();
            fail("IOException was not thrown.");
        } catch(java.io.IOException io) {
            //expected 
        } 
    } 
 
    public void test_getCertificates() throws Exception { 
        URL u = createContent("TestCodeSigners.jar", "Test.class");
 
        juc = (JarURLConnection) u.openConnection();