KAFKA-8006: Guard calls to init and close from global processor#6353
KAFKA-8006: Guard calls to init and close from global processor#6353mjsax merged 2 commits intoapache:trunkfrom
Conversation
mjsax
left a comment
There was a problem hiding this comment.
Overall LGTM. One nit for the unit tests.
|
|
||
| @Test(expected = UnsupportedOperationException.class) | ||
| public void shouldNotAllowInit() { | ||
| globalContext.getStateStore(GLOBAL_STORE_NAME).init(null, null); |
There was a problem hiding this comment.
This is two methods calls, thus it should not be a one liner (test would pass if getStateStore() would throw UnsupportedOperationException.
Should be:
@Test
public void shouldNotAllowInit() {
final StateStore store = globalContext.getStateStore(GLOBAL_STORE_NAME);
try {
store.init(null, null);
fail("Should have thrown UnsupportedOperationException.");
} catch(final UnsupportedOperationException expected) { }
Similar below.
|
Actually, you should compare the tests in |
|
@mjsax Do you mean the tests in general or with regards to init & close specifically? I guess it's not clear to me what benefit the sophistication is really providing here..I felt it was better to do a straightforward test of the single functionality being tested, but am open to doing otherwise |
|
Java 11 failed retest this please |
|
@ableegoldman The fancy test also verifies that only |
guozhangwang
left a comment
There was a problem hiding this comment.
I looked at ProcessorContextImplTest and I agree with @ableegoldman that it seems over-complicated, we do not need to follow its pattern and even better, simplify that one as well.
mjsax
left a comment
There was a problem hiding this comment.
Thanks for the input @guozhangwang!
Merging this now. We can do follow ups if we want to simplify existing test code.
…he#6353) Reviewers: Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>, Matthias J. Sax <matthias@confluent.io>
Guards against users calling init() and close() on global stores accessed via global processor
Committer Checklist (excluded from commit message)