jeudi 25 juin 2015

Unit testing runtime objects

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?

Aucun commentaire:

Enregistrer un commentaire