### Question:
UncachedKeyRing { public UncachedKeyRing extractPublicKeyRing() throws IOException { if(!isSecret()) { throw new RuntimeException("Tried to extract public keyring from non-secret keyring. " + "This is a programming error and should never happen!"); } Iterator<PGPPublicKey> it = mRing.getPublicKeys(); ByteArrayOutputStream stream = new ByteArrayOutputStream(2048); while (it.hasNext()) { stream.write(it.next().getEncoded()); } return new UncachedKeyRing( new PGPPublicKeyRing(stream.toByteArray(), new JcaKeyFingerprintCalculator())); } UncachedKeyRing(PGPKeyRing ring); long getMasterKeyId(); UncachedPublicKey getPublicKey(); UncachedPublicKey getPublicKey(long keyId); Iterator<UncachedPublicKey> getPublicKeys(); boolean isSecret(); byte[] getEncoded(); void encode(OutputStream out); byte[] getFingerprint(); int getVersion(); static UncachedKeyRing decodeFromData(byte[] data); static IteratorWithIOThrow<UncachedKeyRing> fromStream(final InputStream stream); boolean containsSubkey(String expectedFingerprint); void encodeArmored(OutputStream out, String version); @SuppressWarnings("ConstantConditions") CanonicalizedKeyRing canonicalize(OperationLog log, int indent); @SuppressWarnings("ConstantConditions") CanonicalizedKeyRing canonicalize(OperationLog log, int indent, boolean forExport); UncachedKeyRing merge(UncachedKeyRing other, OperationLog log, int indent); UncachedKeyRing extractPublicKeyRing();  }### Answer:
@Test(expected = RuntimeException.class) public void testPublicExtractPublic() throws Exception { pubRing.extractPublicKeyRing(); }