### Question:
OperatorUtil { @SuppressWarnings({ "unchecked", "rawtypes" }) public static Class<? extends Operator> getContractClass(final Class<?> stubClass) { if (stubClass == null) { return null; } final Class<?> contract = STUB_CONTRACTS.get(stubClass); if (contract != null) { return (Class<? extends Operator<?>>) contract; } Iterator<Entry<Class<?>, Class<? extends Operator>>> stubContracts = STUB_CONTRACTS.entrySet().iterator(); while (stubContracts.hasNext()) { Map.Entry<Class<?>, Class<? extends Operator>> entry = stubContracts.next(); if (entry.getKey().isAssignableFrom(stubClass)) { return entry.getValue(); } } return null; }  @SuppressWarnings({ "unchecked", "rawtypes" }) static Class<? extends Operator> getContractClass(final Class<?> stubClass); static int getNumInputs(final Class<? extends Operator<?>> contractType); @SuppressWarnings({ "deprecation", "rawtypes", "unchecked" }) static void setInputs(final Operator<?> contract, final List<List<Operator>> inputs);  }### Answer:
@Test public void getContractClassShouldReturnCoGroupForCoGroupStub() { final Class<?> result = OperatorUtil.getContractClass(CoGrouper.class); assertEquals(CoGroupOperatorBase.class, result); }
@Test public void getContractClassShouldReturnCrossForCrossStub() { final Class<?> result = OperatorUtil.getContractClass(Crosser.class); assertEquals(CrossOperatorBase.class, result); }
@Test public void getContractClassShouldReturnMapForMapStub() { final Class<?> result = OperatorUtil.getContractClass(Mapper.class); assertEquals(CollectorMapOperatorBase.class, result); }
@Test public void getContractClassShouldReturnMatchForMatchStub() { final Class<?> result = OperatorUtil.getContractClass(Matcher.class); assertEquals(JoinOperatorBase.class, result); }
@Test public void getContractClassShouldReturnNullForStub() { final Class<?> result = OperatorUtil.getContractClass(Function.class); assertEquals(null, result); }
@Test public void getContractClassShouldReturnReduceForReduceStub() { final Class<?> result = OperatorUtil.getContractClass(Reducer.class); assertEquals(GroupReduceOperatorBase.class, result); }
@Test public void getContractClassShouldReturnSinkForOutputFormat() { final Class<?> result = OperatorUtil.getContractClass(FileOutputFormat.class); assertEquals(GenericDataSinkBase.class, result); }
@Test public void getContractClassShouldReturnSourceForInputFormat() { final Class<?> result = OperatorUtil.getContractClass(DelimitedInputFormat.class); assertEquals(GenericDataSourceBase.class, result); }