opengrok icon indicating copy to clipboard operation
opengrok copied to clipboard

HistoryGuru#getLastHistoryEntry() is not really covered by tests

Open vladak opened this issue 3 years ago • 2 comments

the HistoryGuru cannot be tested with Mockito because it is final class so the fallback to repository.getLastHistoryEntry() in HistoryGuru#getLastHistoryEntry() is not really covered

There are workarounds for mocking final classes: e.g. https://stackoverflow.com/questions/14292863/how-to-mock-a-final-class-with-mockito (just don't use PowerMock :D)

Otherwise looks good to me.

Originally posted by @ahornace in https://github.com/oracle/opengrok/issues/3861#issuecomment-1006038466

vladak avatar Jan 06 '22 10:01 vladak

@vladak can I contribute to this? is no one working on it?

can you please once confirm if we can use MockitoV2 for final class mocking

aditya-32 avatar Apr 21 '23 13:04 aditya-32

@vladak can I contribute to this? is no one working on it?

Whoever submits the PR first wins :-) Joking aside, given the amount of contributions OpenGrok gets, it's pretty much guaranteed that no one is working on it at the moment. Certainly I don't plan to.

can you please once confirm if we can use MockitoV2 for final class mocking

Do you mean Mockito 2.x ? If so, OpenGrok is already on 3.x.

vladak avatar Apr 21 '23 15:04 vladak