You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Uma Maheswara Rao G (Jira)" <ji...@apache.org> on 2021/08/20 17:28:00 UTC

[jira] [Created] (HDDS-5650) Wrong mock assumption in TestOmMetrics#testBucketOps

Uma Maheswara Rao G created HDDS-5650:
-----------------------------------------

             Summary: Wrong mock assumption in TestOmMetrics#testBucketOps
                 Key: HDDS-5650
                 URL: https://issues.apache.org/jira/browse/HDDS-5650
             Project: Apache Ozone
          Issue Type: Sub-task
    Affects Versions: 1.1.0
            Reporter: Uma Maheswara Rao G


I noticed a mock in this test as follows:


{code:java}
Mockito.doReturn(null).when(mockBm).getBucketInfo(null, null);{code}
But in reality the behavior would be different as per the source code:


{code:java}
@Override
public OmBucketInfo getBucketInfo(String volumeName, String bucketName)
 throws IOException {
 Preconditions.checkNotNull(volumeName);
 Preconditions.checkNotNull(bucketName);{code}
 

Due to the above preconditions, null is not allowed and it will throw NPE.

Some one who familiar with this code can confirm why we added this differed mock behavior.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org