Details
Description
The order dependent flakiness was detected when running multiple test classes. The polluter that caused the flakiness in AttachmentUtilTest.java was the test class CachedOutputStreamTest.java. In AttachmentUtilTest, there were multiple tests that used Mockito.spy() to verify the behavior of CachedOutputStream object. In those tests, the spy CachedOutputStream object "cos" was generated (CachedOutputStream cos = spy(CachedOutputStream.class)). Then after this, there was a line verify(cos).setThreshold(102400L). Therefore, after the cos being initialized, we need to make sure the setThreshold has been called once. However, it doens't execute as expected, and the root cause is that the threshold is not provided when calling testSetStreamedAttachmentProperties() method and the thresholdSysPropSet (the boolean that indicated whether the default threshold has been set or not) has been set to true when we run the CachedOutputStreamTest.java. Inside the CachedOutputStreamTest.java, the unit test testUseSysPropsWithAttachmentDeserializer() called the AttachmentUtil.setStreamedAttachmentProperties(message, cache), so the thresholdSysPropSet has been set to true then. Therefore, if we run CachedOutputStreamTest.java before running the AttachmentUtilTest.java, the verify(cos).setThreshold(102400L) statement will lead to the error messageĀ
Wanted but not invoked:
cachedOutputStream.setThreshold(102400L);
-> at org.apache.cxf.attachment.AttachmentUtilTest.bigIntAsAttachmentMaxSize(AttachmentUtilTest.java:279)
Attachments
Attachments
Issue Links
- links to