Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ public Path[] answer(InvocationOnMock invocation) throws Throwable {
return DistributedCache.getLocalCacheFiles(configuration);
}
});

when(context.getNumReduceTasks()).thenAnswer(new Answer<Integer>() {
@Override
@SuppressWarnings("deprecation")
public Integer answer(InvocationOnMock invocation) throws Throwable {
return configuration.getInt("mapred.reduce.tasks", 1);
}
});

} catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.mrunit.internal.output.MockOutputCreator;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.apache.hadoop.mrunit.types.Pair;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

Expand Down Expand Up @@ -71,7 +72,7 @@ public MockMapContextWrapper(
@Override
@SuppressWarnings({ "unchecked" })
protected Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create() {
final Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Mapper.Context.class);
final Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Mapper.Context.class, Mockito.RETURNS_DEEP_STUBS);

createCommon(context, driver, mockOutputCreator);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hadoop.mrunit.internal.output.MockOutputCreator;
import org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
import org.apache.hadoop.mrunit.types.KeyValueReuseList;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

Expand Down Expand Up @@ -80,7 +81,7 @@ public MockReduceContextWrapper(
@SuppressWarnings({ "unchecked" })
protected Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create() {

final Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Reducer.Context.class);
final Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Reducer.Context.class, Mockito.RETURNS_DEEP_STUBS);

createCommon(context, driver, mockOutputCreator);
try {
Expand Down