Dale Emery created GEODE-5226:
---------------------------------

             Summary: Decouple BaseCommand from response writing and exception 
handling
                 Key: GEODE-5226
                 URL: https://issues.apache.org/jira/browse/GEODE-5226
             Project: Geode
          Issue Type: Improvement
          Components: regions
            Reporter: Dale Emery


To facilitate testing, provide an easier way to verify that each command sends 
the appropriate responses.

Currently, the responsibility to write and send responses, and the 
responsibility to handle and report exceptions, are implemented as static 
methods on `BaseCommand`. The static methods are difficult to fake for testing 
purposes, to test that individual commands send replies and handle exceptions 
properly.

So: Extract some or all of the response-writing (writeXXX) and 
exception-handling (handleXXX) methods from `BaseCommand` into one or more 
classes focused on those responsibilities. Give `BaseCommand` and its 
subclasses a factory to construct any response-writer and/or exception-handler 
instances.

As needed, add constructors to allow tests to supply test-specific factories 
for the helpers. Tests can create fake helpers (such as mocks) that are easy to 
control and observe.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to