aremily commented on a change in pull request #99:
URL: https://github.com/apache/commons-crypto/pull/99#discussion_r417019278



##########
File path: 
src/test/java/org/apache/commons/crypto/stream/CtrCryptoStreamTest.java
##########
@@ -52,4 +75,115 @@ protected CtrCryptoOutputStream getCryptoOutputStream(
         }
         return new CtrCryptoOutputStream(baos, cipher, bufferSize, key, iv);
     }
+    
+    @Override
+    protected CtrCryptoOutputStream getCryptoOutputStream(final String 
transformation,
+            final Properties props, final ByteArrayOutputStream baos, final 
byte[] key, 
+            final AlgorithmParameterSpec params, final boolean withChannel) 
throws IOException {
+        if (withChannel) {
+            return new CtrCryptoOutputStream(props, Channels.newChannel(baos), 
key, 
+                    ((IvParameterSpec)params).getIV());
+        }
+        return new CtrCryptoOutputStream(props, baos, 
key,((IvParameterSpec)params).getIV());
+    }
+    
+    @Override
+    protected void doFieldGetterTest(final String cipherClass, final 
ByteArrayOutputStream baos,
+            final boolean withChannel) throws Exception {
+        if (AbstractCipherTest.OPENSSL_CIPHER_CLASSNAME.equals(cipherClass)) {
+            if (!Crypto.isNativeCodeLoaded()) {
+                return; // Skip this test if no JNI
+            }
+        }
+        
+        StreamInput streamInput = new StreamInput(new 
ByteArrayInputStream(encData), 0);
+        try {
+            streamInput.seek(0);
+            Assert.fail("Expected UnsupportedOperationException.");
+        } catch (UnsupportedOperationException ex) {
+               Assert.assertEquals(ex.getMessage(), "Seek is not supported by 
this implementation");

Review comment:
       I agree, but I think that's the point of the tests.  I would want a 
future developer to be conscious of the impact that changes had on the test and 
make necessary modifications, but I don't want to get into a philosophical 
discussion about software testing...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to