### Question:
MorphlineResultToSolrMapper implements ResultToSolrMapper, Configurable { @Override public boolean isRelevantKV(KeyValue kv) { return localMorphlineMapper.get().isRelevantKV(kv); } MorphlineResultToSolrMapper(); @Override void configure(Map<String, String> config); @Override boolean containsRequiredData(Result result); @Override boolean isRelevantKV(KeyValue kv); @Override Get getGet(byte[] row); @Override void map(Result result, SolrUpdateWriter solrUpdateWriter); static final String MORPHLINE_FILE_PARAM; static final String MORPHLINE_ID_PARAM; static final String MORPHLINE_VARIABLE_PARAM; static final String MORPHLINE_FIELD_PARAM; static final String OUTPUT_MIME_TYPE; }### Answer:
@Test public void testIsRelevantKV_WithoutWildcards() { FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:qualifier", ValueSource.VALUE, "byte[]"); MorphlineResultToSolrMapper resultMapper = createMorphlineMapper(fieldDef); KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"), Bytes.toBytes("value")); KeyValue notRelevantKV_WrongFamily = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("wrongcf"), Bytes.toBytes("qualifier"), Bytes.toBytes("value")); KeyValue notRelevantKV_WrongQualifier = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("wrongqualifier"), Bytes.toBytes("value")); assertTrue(resultMapper.isRelevantKV(relevantKV)); assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongFamily)); assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier)); }
@Test public void testIsRelevantKV_WithWildcards() { FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:quali*", ValueSource.QUALIFIER, "int"); MorphlineResultToSolrMapper resultMapper = createMorphlineMapper(fieldDef); KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"), Bytes.toBytes("value")); KeyValue notRelevantKV_WrongFamily = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("wrongcf"), Bytes.toBytes("qualifier"), Bytes.toBytes("value")); KeyValue notRelevantKV_WrongQualifier = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qu wrong qualifier"), Bytes.toBytes("value")); assertTrue(resultMapper.isRelevantKV(relevantKV)); assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongFamily)); assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier)); }