def test_all_success(self):
   suite = """
   <foo>
   <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.squareup.crypto.pssr.PssrTest" time="0.684" tests="6" errors="0" skipped="0" failures="0">
   <testcase name="testTamperedSignatureCausesFailure" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecover" classname="com.squareup.crypto.pssr.PssrTest" time="0.224"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecoverWithCorruptedUnrecoverableData" classname="com.squareup.crypto.pssr.PssrTest" time="0"/>
   <testcase name="testMessageSizeBoundaries" classname="com.squareup.crypto.pssr.PssrTest" time="0"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecoverWithUnrecoverableData" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   <testcase name="testSignAndEncodeWithTestVectors" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   </testsuite>
   </foo>
   """
   lst = list(junit_report.parse_string(suite))
   self.assertEquals(len(lst), 6)
   for elem in lst:
       self.assertEquals(elem.state, junit_report.State.SUCCESS)
       self.assertLess(elem.time, 0.3)
   self.assertEquals(lst[0].full_name, 'com.squareup.crypto.pssr.PssrTest.testTamperedSignatureCausesFailure')
   self.assertEquals(lst[1].full_name, 'com.squareup.crypto.pssr.PssrTest.testSignAndEncodeThenVerifyAndRecover')
   self.assertEquals(lst[2].full_name, 'com.squareup.crypto.pssr.PssrTest.testSignAndEncodeThenVerifyAndRecoverWithCorruptedUnrecoverableData')
   self.assertEquals(lst[3].full_name, 'com.squareup.crypto.pssr.PssrTest.testMessageSizeBoundaries')
   self.assertEquals(lst[4].full_name, 'com.squareup.crypto.pssr.PssrTest.testSignAndEncodeThenVerifyAndRecoverWithUnrecoverableData')
   self.assertEquals(lst[5].full_name, 'com.squareup.crypto.pssr.PssrTest.testSignAndEncodeWithTestVectors')
   self.assertEquals(lst[1].time, 0.224)
 def test_alien_failure(self):
   suite = """
   <testsuite errors="0" failures="1" name="com.squareup.activity.collector.ActivityCollectorAcceptanceTest" tests="3" time="4.083678">
   <testcase classname="com.squareup.activity.collector.ActivityCollectorAcceptanceTest" name="test2" time="1.037436">
       <boomboom><foo>The eagle has left the nest. Repeat, the eagle has left the nest.</foo></boomboom>
   </testcase>
   </testsuite>
   """
   lst = list(junit_report.parse_string(suite))
   self.assertEquals(len(lst), 1)
   self.assertEquals(lst[0].state, junit_report.State.FAILURE)
 def test_malformed_time_field(self):
   suite = """
   <testsuite errors="0" failures="1" name="com.squareup.activity.collector.ActivityCollectorAcceptanceTest" tests="3" time="4.083678">
   <testcase classname="com.squareup.activity.collector.ActivityCollectorAcceptanceTest" name="test2" time="potato">
       <failure message="Actual and expected have the same elements but not in the same order, at index 0 actual element was:"
               type="java.lang.AssertionError">java.lang.AssertionError:
       at org.pantsbuild.tools.junit.ConsoleRunner.main(ConsoleRunner.java:12)
   </failure>
   </testcase>
   </testsuite>
   """
   lst = list(junit_report.parse_string(suite))
   self.assertEquals(len(lst), 1)
   self.assertEquals(lst[0].state, junit_report.State.FAILURE)
 def test_one_failure(self):
   suite = """
   <foo>
   <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.squareup.crypto.PrivateKeysTest" time="0.191" tests="3" errors="1" skipped="0" failures="0">
   <testcase name="keyDecryptFailsWithWrongPassword" classname="com.squareup.crypto.PrivateKeysTest" time="0.066"/>
   <testcase name="canDecodeEncryptedKey" classname="com.squareup.crypto.PrivateKeysTest" time="0.012">
   java.lang.RuntimeException: org.bouncycastle.openssl.PEMException: Unable to create OpenSSL PBDKF: PBKDF-OpenSSL SecretKeyFactory not available at com.google.common.base.Throwables.propagate(Throwables.java:160) at com.squareup.crypto.PrivateKeys.fromPem(PrivateKeys.java:63) at com.squareup.crypto.PrivateKeysTest.canDecodeEncryptedKey(PrivateKeysTest.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55) at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:130) at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:101) at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:77) at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:177) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:286) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:240) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) Caused by: org.bouncycastle.openssl.PEMException: Unable to create OpenSSL PBDKF: PBKDF-OpenSSL SecretKeyFactory not available at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source) at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source) at org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder$1$1.decrypt(Unknown Source) at org.bouncycastle.openssl.PEMEncryptedKeyPair.decryptKeyPair(Unknown Source) at com.squareup.crypto.PrivateKeys.fromPem(PrivateKeys.java:60) ... 34 more Caused by: java.security.NoSuchAlgorithmException: PBKDF-OpenSSL SecretKeyFactory not available at javax.crypto.SecretKeyFactory.init(SecretKeyFactory.java:121) at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:159) at org.bouncycastle.jcajce.util.DefaultJcaJceHelper.createSecretKeyFactory(Unknown Source) ... 39 more
   </testcase>
   <testcase name="pemEncodeDecodeIsSymmetric" classname="com.squareup.crypto.PrivateKeysTest" time="0.104"/>
   </testsuite>
   </foo>
   """
   lst = list(junit_report.parse_string(suite))
   self.assertEquals(len(lst), 3)
   self.assertEquals(lst[1].state, junit_report.State.FAILURE)
   self.assertEquals(lst[0].state, junit_report.State.SUCCESS)
   self.assertEquals(lst[2].state, junit_report.State.SUCCESS)
 def test_hidden_failure(self):
   suite = """
   <foo>
   <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.squareup.crypto.pssr.PssrTest" time="0.684" tests="6" errors="0" skipped="0" failures="1">
   <testcase name="testTamperedSignatureCausesFailure" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecover" classname="com.squareup.crypto.pssr.PssrTest" time="0.224"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecoverWithCorruptedUnrecoverableData" classname="com.squareup.crypto.pssr.PssrTest" time="0"/>
   <testcase name="testMessageSizeBoundaries" classname="com.squareup.crypto.pssr.PssrTest" time="0"/>
   <testcase name="testSignAndEncodeThenVerifyAndRecoverWithUnrecoverableData" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   <testcase name="testSignAndEncodeWithTestVectors" classname="com.squareup.crypto.pssr.PssrTest" time="0.001"/>
   </testsuite>
   </foo>
   """
   lst = list(junit_report.parse_string(suite))
   self.assertEquals(len(lst), 7)
   for i in range(6):
       self.assertEquals(lst[i].state, junit_report.State.SUCCESS)
   self.assertEquals(lst[6].state, junit_report.State.FAILURE)
   self.assertEquals(lst[6].full_name, 'com.squareup.crypto.pssr.PssrTest.DUMMY_TEST')