[bisq-network/bisq] (1/8) [TESTS] Add tests for P2PDataStorage in order to safely refactor (#3554)

Julian Knutsen notifications at github.com
Sat Nov 9 15:31:34 UTC 2019


julianknutsen commented on this pull request.



> + * License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Bisq. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package bisq.network.p2p.storage.mocks;
+
+import bisq.network.p2p.storage.P2PDataStorage;
+import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
+import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppendOnlyDataStoreServiceFake extends AppendOnlyDataStoreService {

This just uses standard terms for test objects so developers can understand the behavior and contract.  I use Fake, Dummy, and Stub as defined here: https://martinfowler.com/articles/mocksArentStubs.html#TheDifferenceBetweenMocksAndStubs

Specifically, fakes have working implementations of the interface, but use optimizations to make them easy to use in tests. For these, an in-memory map is used instead of persistent storage.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3554#discussion_r344448953
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191109/5ef084cf/attachment.html>


More information about the bisq-github mailing list