class reduce {
private HTable table = null;
protected void setup() {
table = new HTable(context.getConfiguration,"tablename");
}
public void reduce() {
...
}
}
我想为上面的代码编写单元测试,但我不知道如何模拟HTable,它总是运行错误(找不到hbase-default.xml错误..)。我认为它发生在新的HTable()中。有没有方法可以模拟这个对象并将其传递给reduce类?
现在我正在使用JUnit,MRUnit,Powermock + mockito。