[bisq-network/bisq] (7/8) Develop APIs for ProtectedStorageEntry to enable testing and code refactoring (#3583)

Julian Knutsen notifications at github.com
Fri Nov 15 17:38:31 UTC 2019


Another way I have thought about this refactor and why I think it is a good path moving forward is that all of these instance methods are equivalent to just testable static methods that operate on final variables. For example, you could just have a bunch of helper functions that look like this:

```
public static void isValidForAddOperation(ProtectedStorageEntry entry) {
  // check signature
  Sig.verify(entry.getPubKey(), hash(entry.getProtectedPayload()))

// check key matches... etc...
}
```

BUT, by using them as instance methods you get the benefit of being able to mock them easily for testing which I think outweighs the anxiety around hiding these checks behind an interface. It may make sense in the future to guarantee that these types of functions only operate on `final` variables so they are equivalent to static methods with test benefits.

-- 
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/3583#issuecomment-554456518
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191115/7b35ae7c/attachment.html>


More information about the bisq-github mailing list