You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/09/08 06:55:02 UTC

[GitHub] [commons-configuration] wx930910 opened a new pull request #142: Replace DummyLayout with mocking object and improve test design

wx930910 opened a new pull request #142:
URL: https://github.com/apache/commons-configuration/pull/142


   Fixes [CONFIGURATION-810](https://issues.apache.org/jira/browse/CONFIGURATION-810)
   
   ### Description
   
   #### Refactor test class [DummyLayout](https://github.com/apache/commons-configuration/blob/66b4f4eb73b276d041debaad80af3074ccb359bd/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java#L91) and test file [TestPropertiesConfiguration.java](https://github.com/apache/commons-configuration/blob/66b4f4eb73b276d041debaad80af3074ccb359bd/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java#L87).
   
   <hr>
   
   ##### Motivation
   
    - Decouple test class `DummyLayout` from production class `PropertiesConfigurationLayout`.
    - Make test logic more clear by removing the overridden method in `DummyLayout`.
    - Make test condition more explict by directly using `Mockito.verify()` to verify method execution status.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    - Add Mockito as testing dependency.
    - Created mocking object to replace test subclass `DummyLayout`, decoupled test from production code.
    - Remove the `int` variable that used to keep tracking the invocation times of `load(PropertiesConfiguration, Reader)`.
    - Use `Mockito.verify()` to check execution status of `load(PropertiesConfiguration, Reader)`.
   
   <hr>


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org