Codegass opened a new pull request #2553:
URL: https://github.com/apache/accumulo/pull/2553


   ## Description 
   This pull request refactors the test case 
[testGetByPrefix](https://github.com/apache/accumulo/tree/main/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L206)
 in test class AccumuloConfigurationTest. 
   
   Currently, this test case combines 10 different test scenarios for the 
getAllPropertiesWithPrefix(). The refactoring breaks this test case down into 
10 separate test cases, each of which focuses on one scenario. This will make 
the test cases smaller and simpler---thus easier to understand and maintain. 
This should also make debugging easier since each test case is more focused.
   
   Note that this refactor keeps the test logic related to 
`Property.VFS_CONTEXT_CLASSPATH_PROPERTY`, which will be [deprecated since 
accumulo 
2.1.0.](https://github.com/apache/accumulo//tree/main/core/src/main/java/org/apache/accumulo/core/conf/Property.java#L1177)
 
   
   ## Motivation
   
   - Make test cases smaller, simpler, and easier to understand: The original 
test case is too long and complicated with combined test scenarios. By 
extracting the test targets to 10 separate unit test cases focusing on specific 
test scenarios. Each test case is kept small and simple, and given a meaningful 
name to show its purpose. And each test case now follows the clear A-arrange, 
A-action, and A-assert structure, which is easy for anyone to quickly pick up 
and change in the future.
   
   - Debugging will be much less of a headache. With the original one big test 
case, if it fails, it is difficult to tell why it fails, due to the cluttered 
structure. Now, separating into 10 test cases, each test case fails for only 
one scenario. This makes bugs more difficult to hide and debugging easier.
   
   ## Key Changes in this PR
   
   - Replace the 
[testGetByPrefix](https://github.com/apache/accumulo/tree/main/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L206)
  test case with 10 unit tests, each unit test case is named based on the test 
target and its specific action or parameter in the testing:
     - 
[testGetByPrefixWithTableArbitraryPropPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L226-L240)
     - 
[testGetByPrefixWithTableIteratorScanPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L243-L257)
     - 
[testGetByPrefixVFSContextClasspathProp](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L260-L270)
     - 
[testGetByPrefixGetOnePrefixNotRegenerateOther](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L273-L291)
   
     - 
[testGetByPrefixWithOneTimeRegeneratedTableIteratorScanPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L294-L314)
     - 
[testGetByPrefixWithOneTimeRegeneratedTableArbitraryPropPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L317-L335)
     - 
[testGetByPrefixWithOneTimeRegeneratedVFSContextClasspathProp](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L338-L355)
   
     - 
[testGetByPrefixWithTwiceRegeneratedTableIteratorScanPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L358-L380)
     - 
[testGetByPrefixWithTwiceRegeneratedTableArbitraryPropPrefix](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L383-L403)
     - 
[testGetByPrefixGetOnePrefixNotRegenerateOtherAfterRegenerate](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L406-L424)
   
   - The reused arrangement statements are extracted as 
[setUpTestConfigForGetByPrefix()](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L206-L217)
 and 
   
[reSetTestConfigForGetByPrefix()](https://github.com/Codegass/accumulo/tree/refactor-configurationTest/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java#L219-L223).


-- 
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: notifications-unsubscr...@accumulo.apache.org

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


Reply via email to