Hi, guys,
I'm facing problem of mocking HttpServerExchange via Mockito which
fails because HttpServerExchange is marked as final. This is a bit
disappointing and forces me to use other testing framework(e.g.
PowerMock).
I've never seen situation where one must use final on class, and
many situations where it was removed. For example, last time in
aerospike client code:
BEFORE (watch final method - client can't be mocked)
https://github.com/aerospike/aerospike-client-java/blob/2.1.0/client/src/com/aerospike/client/AerospikeClient.java
AFTER(now final methods are still in place BUT class now implements
interface I
AerospikeClient - client methods now can be mocked via mocking
interface)
https://github.com/aerospike/aerospike-client-java/blob/3.1.2/client/src/com/aerospike/client/AerospikeClient.java
Can you explain what are the reasons to use final here? May be
remove final or switch to interface?
--
Ilya Karpov
Developer
CleverDATA
make your data clever