### Question:
DateIndexDataTypeHandler implements DataTypeHandler<KEYIN>, RawRecordMetadata { @Override public void setup(TaskAttemptContext context) { this.taskAttemptContext = context; this.conf = context.getConfiguration(); this.shardIdFactory = new ShardIdFactory(conf); String tableName = conf.get(DATEINDEX_TNAME, null); if (null == tableName) { log.error(DATEINDEX_TNAME + " not specified, no date index will be created"); } else { setDateIndexTableName(new Text(tableName)); } this.dateIndexNumShards = conf.getInt(DATEINDEX_NUM_SHARDS, this.dateIndexNumShards); TypeRegistry registry = TypeRegistry.getInstance(conf); dataTypeToTypeToFields = new HashMap<>(); for (Type dataType : registry.getTypes()) { Set<String> typeToFieldsSet = new HashSet<>(); typeToFieldsSet.addAll(conf.getTrimmedStringCollection("all" + DATEINDEX_TYPE_TO_FIELDS)); typeToFieldsSet.addAll(conf.getTrimmedStringCollection(dataType.typeName() + DATEINDEX_TYPE_TO_FIELDS)); Multimap<String,String> typeToFields = HashMultimap.create(); for (String typeToField : typeToFieldsSet) { String[] parts = StringUtils.split(typeToField, '='); if (parts.length != 2) { throw new IllegalStateException("Improper date index type to field configuration: " + typeToField); } typeToFields.put(parts[0], parts[1]); } log.info(this.getClass().getSimpleName() + " configured for " + dataType.typeName() + ": " + typeToFields); dataTypeToTypeToFields.put(dataType.typeName(), typeToFields); } }  Set<Type> getDataTypes(); Set<String> getTypes(Type dataType); Set<String> getTypes(Type dataType, String field); Set<String> getFields(Type dataType, String type); Set<String> getFields(Type dataType); @Override void setup(TaskAttemptContext context); @Override String[] getTableNames(Configuration conf); @Override int[] getTableLoaderPriorities(Configuration conf); @Override Multimap<BulkIngestKey,Value> processBulk(KEYIN keyin, RawRecordContainer event, Multimap<String,NormalizedContentInterface> eventFields,
                    StatusReporter reporter); KeyValue getDateIndexEntry(String shardId, String dataType, String type, String dateField, String dateValue, ColumnVisibility visibility); String getShardId(RawRecordContainer event); int getDateIndexShardPartition(String... values); Text getDateIndexTableName(); void setDateIndexTableName(Text dateIndexTableNameText); @Override RawRecordMetadata getMetadata(); @Override IngestHelperInterface getHelper(Type type); @Override void close(TaskAttemptContext context); @Override void addEvent(IngestHelperInterface helper, RawRecordContainer event, Multimap<String,NormalizedContentInterface> fields, long loadTimeInMillis); @Override void addEvent(IngestHelperInterface helper, RawRecordContainer event, Multimap<String,NormalizedContentInterface> fields); @Override void addEventWithoutLoadDates(IngestHelperInterface helper, RawRecordContainer event, Multimap<String,NormalizedContentInterface> fields); @Override void addEvent(IngestHelperInterface helper, RawRecordContainer event, Multimap<String,NormalizedContentInterface> fields, boolean frequency); @Override Multimap<BulkIngestKey,Value> getBulkMetadata(); @Override void clear(); static final String DATEINDEX_TNAME; static final String DATEINDEX_LPRIORITY; static final String DATEINDEX_TYPE_TO_FIELDS; static final String DATEINDEX_NUM_SHARDS; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testMissingConfigSetup() { DateIndexDataTypeHandler<Text> handler = new DateIndexDataTypeHandler<>(); handler.setup(new TaskAttemptContextImpl(new Configuration(), new TaskAttemptID())); }