0

I'm following the Tweet ingestion tutorial from Cloudera here and here. The libraries involved here are Twitter4J and Flume.

However, my question here is related to unit testing, so even those who are knowledgeable about unit testing (JUnit, Mockito, PowerMock, etc.) may answer, even if not knowledgeable about Twitter4J or Big Data component like Flume.

I have a class that I wish to test:

class TwitterConnection {

    public TwitterConnection setCredentialsFromFlumeConfig(Context context) {

        // get variables from Flume agent config file using org.apache.flume.Context

        return this;
    }

}

org.apache.flume.Context is a runtime object, existing only when I run the entire application (Flume agent to be exact), which I don't know how to mock and test. Can anyone give an idea how to do this?

1 Answer 1

2

The easiest way to do this is to create a thin wrapper object for it, and mock it. You can look at a similar response here: How do you test code written against AWS API

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.