Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-4646: Improve test coverage AbstractProcessorContext #2447

Closed
wants to merge 3 commits into from

Conversation

dguy
Copy link
Contributor

@dguy dguy commented Jan 26, 2017

Exception paths in register(), topic(), partition(), offset(), and timestamp(), were not covered by any existing tests

@dguy
Copy link
Contributor Author

dguy commented Jan 26, 2017

@asfbot
Copy link

asfbot commented Jan 26, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1249/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 26, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1247/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jan 26, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1247/
Test FAILed (JDK 7 and Scala 2.10).

public static Properties minimalStreamsConfig() {
final Properties properties = new Properties();
properties.put(StreamsConfig.APPLICATION_ID_CONFIG, UUID.randomUUID().toString());
properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "blah:9092");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we change blah to anyServer or something less blah-y? Otherwise LGTM

@asfbot
Copy link

asfbot commented Feb 2, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1434/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Feb 2, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1437/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Feb 2, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1434/
Test PASSed (JDK 8 and Scala 2.12).

@Test(expected = IllegalStateException.class)
public void shouldThrowIllegalStateExceptionOnRegisterWhenContextIsInitialized() throws Exception {
context.initialized();
context.register(stateStore, false, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use try-catch instead of expected annotation -- not a single line test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-)

@Test(expected = IllegalStateException.class)
public void shouldThrowIllegalStateExceptionOnTopicIfNoRecordContext() throws Exception {
context.setRecordContext(null);
context.topic();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

@Test(expected = IllegalStateException.class)
public void shouldThrowIllegalStateExceptionOnPartitionIfNoRecordContext() throws Exception {
context.setRecordContext(null);
context.partition();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above.

@Test(expected = IllegalStateException.class)
public void shouldThrowIllegalStateExceptionOnOffsetIfNoRecordContext() throws Exception {
context.setRecordContext(null);
context.offset();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@Test(expected = IllegalStateException.class)
public void shouldThrowIllegalStateExceptionOnTimestampIfNoRecordContext() throws Exception {
context.setRecordContext(null);
context.timestamp();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@asfbot
Copy link

asfbot commented Feb 3, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1458/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Feb 3, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1461/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Feb 3, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1458/
Test PASSed (JDK 7 and Scala 2.10).

Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and merged to trunk.

@asfgit asfgit closed this in d95f22c Feb 3, 2017
soenkeliebau pushed a commit to soenkeliebau/kafka that referenced this pull request Feb 7, 2017
Exception paths in `register()`, `topic()`, `partition()`, `offset()`, and `timestamp()`, were not covered by any existing tests

Author: Damian Guy <damian.guy@gmail.com>

Reviewers: Eno Thereska, Matthias J. Sax

Closes apache#2447 from dguy/KAFKA-4646
@dguy dguy deleted the KAFKA-4646 branch February 17, 2017 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants