Java 8 NullCipher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NullCipher class.

This code example shows how to use the following methods:
    public void testCheckedInputStream() throws IOException { 
        assertReadsFailWithNullPointerException(new CheckedInputStream(null, new CRC32()));
    } 
 
    public void testCipherInputStream() throws IOException { 
        InputStream in = new CipherInputStream(null, new NullCipher());
        try { 
            in.read();
            fail();
        } catch (NullPointerException expected) {
        } 
 
        assertEquals(0, in.available());
 
        try { 
            in.close();
            fail();
        } catch (NullPointerException expected) {
        } 
    } 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    /** 
     * @tests javax.crypto.CipherInputStream#read(byte[] b, int off, int len) 
     */ 
    public void testReadBII() throws Exception { 
        // Regression for HARMONY-1080 
        CipherInputStream stream = new CipherInputStream(null, new NullCipher());
        try { 
            stream.read(new byte[1], 1, 0);
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            // expected 
        } 
    } 
 
    /** 
     * @tests javax.crypto.CipherInputStream#close() 
     */ 
    public void testClose() throws Exception { 
        // Regression for HARMONY-1087 
        try { 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
                bos.toByteArray()));
 
        SealedObject so_des = (SealedObject) ois.readObject();
        assertEquals("The secret content of deserialized object "
                + "should be equal to the secret content of initial object", 
                secret, so_des.getObject(new NullCipher()));
        assertEquals("The value returned by getAlgorithm() method of "
                + "deserialized object should be equal to the value returned " 
                + "by getAlgorithm() method of initial object", so
                .getAlgorithm(), so_des.getAlgorithm());
    } 
 
    /** 
     * SealedObject(Serializable object, Cipher c) method testing. Tests if the 
     * NullPointerException is thrown in the case of null cipher. 
     */ 
    public void testSealedObject1() throws Exception { 
        String secret = "secret string";
        try { 
            new SealedObject(secret, null);
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
 
    private Cipher c;
 
    protected void setUp() throws Exception { 
        super.setUp(); 
        c = new NullCipher();
    } 
 
    public void testGetAlgorithm() { 
        c.getAlgorithm();
    } 
 
    public void testGetBlockSize() { 
        assertEquals("Incorrect BlockSize", 1, c.getBlockSize());
    } 
 
    public void testGetOutputSize() { 
        assertEquals("Incorrect OutputSize", 111, c.getOutputSize(111));
    } 
 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
                bos.toByteArray()));
 
        SealedObject so_des = (SealedObject) ois.readObject();
        assertEquals("The secret content of deserialized object "
                + "should be equal to the secret content of initial object", 
                secret, so_des.getObject(new NullCipher()));
        assertEquals("The value returned by getAlgorithm() method of "
                + "deserialized object should be equal to the value returned " 
                + "by getAlgorithm() method of initial object", so
                .getAlgorithm(), so_des.getAlgorithm());
    } 
 
    /** 
     * SealedObject(Serializable object, Cipher c) method testing. Tests if the 
     * NullPointerException is thrown in the case of null cipher. 
     */ 
    public void testSealedObject1() throws Exception { 
        String secret = "secret string";
        try { 
            new SealedObject(secret, null);
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE