### Question:
DatasetImporterForMetaTable extends DatasetImporterWithListener { public static InteractType generateInteractionType(Map<String, String> properties, InteractTypeMapper mapper) { final String interactionTypeName = properties.get(DatasetImporterForTSV.INTERACTION_TYPE_NAME); return StringUtils.isNotBlank(interactionTypeName) ? mapper.getInteractType(interactionTypeName) : null; } DatasetImporterForMetaTable(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static void append(StringBuilder citation, String value, String suffix, String prefix); static void append(StringBuilder citation, String value, String continuation); static InteractType generateInteractionType(Map<String, String> properties, InteractTypeMapper mapper); JsonNode getConfig(); String getBaseUrl(); static void importAll(InteractionListener interactionListener,
                                 List<Column> columnNames,
                                 CSVParse csvParse, JsonNode config, ImportLogger importLogger); static void parseColumnValue(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static void logParseWarning(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static String valueOrDefault(String value, Column column); static void setInteractionType(Map<String, String> properties, InteractType type); static String parseValue(String value, Column column); void setDataset(Dataset dataset); Dataset getDataset(); static List<Column> columnNamesForMetaTable(JsonNode config); static List<Column> columnNamesForSchema(JsonNode tableSchema); static Column createStringColumn(JsonNode columnName); static final String AUTHOR; static final String TITLE; static final String YEAR; static final String JOURNAL; static final String VOLUME; static final String NUMBER; static final String PAGES; static final String LONGITUDE; static final String LATITUDE; static final String EVENT_DATE; }### Answer:
@Test public void interactionTypeMapping() { InteractTypeMapper mapper = new InteractTypeMapper() { @Override public boolean shouldIgnoreInteractionType(String nameOrId) { return false; } @Override public InteractType getInteractType(String nameOrId) { return null; } }; assertThat(DatasetImporterForMetaTable.generateInteractionType(interactMap("donald"), mapper), is(nullValue())); }
@Test public void interactionTypeMappingValid() { InteractTypeMapper mapper = new InteractTypeMapper() { @Override public boolean shouldIgnoreInteractionType(String nameOrId) { return false; } @Override public InteractType getInteractType(String nameOrId) { return InteractType.POLLINATES; } }; assertThat(DatasetImporterForMetaTable.generateInteractionType(interactMap("pollinator"), mapper), is(InteractType.POLLINATES)); }