### Question:
InlineTableUtil { static public Map<String, String> match(Table<Integer, String, String> table, Map<String, FieldValue> values){ Set<Integer> rowKeys = table.rowKeySet(); rows: for(Integer rowKey : rowKeys){ Map<String, String> row = table.row(rowKey); if(values.size() < (row.size() - 1)){ continue rows; } Collection<Map.Entry<String, FieldValue>> entries = values.entrySet(); for(Map.Entry<String, FieldValue> entry : entries){ String key = entry.getKey(); FieldValue value = entry.getValue(); String rowValue = row.get(key); if(rowValue == null){ continue rows; } boolean equals = value.equalsString(rowValue); if(!equals){ continue rows; } } return row; } return null; } private  InlineTableUtil(); static Table<Integer, String, String> getContent(InlineTable inlineTable); static Table<Integer, String, String> parse(InlineTable inlineTable); static Map<String, String> match(Table<Integer, String, String> table, Map<String, FieldValue> values);  }### Answer:
@Test public void matchSingleColumn(){ Map<String, String> first = createRow(new String[][]{{"value", "1"}, {"output", "first"}}); Map<String, String> second = createRow(new String[][]{{"value", "2"}, {"output", "second"}}); Map<String, String> third = createRow(new String[][]{{"value", "3"}, {"output", "third"}}); Table<Integer, String, String> table = createTable(first, second, third); assertEquals(first, InlineTableUtil.match(table, createValues(new Object[][]{{"value", "1"}}))); assertEquals(second, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 2}}))); assertEquals(third, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 3d}}))); assertEquals(null, InlineTableUtil.match(table, createValues(new Object[][]{{"value", "false"}}))); }
@Test public void matchMultipleColumns(){ Map<String, String> firstTrue = createRow(new String[][]{{"value", "1"}, {"flag", "true"}, {"output", "firstTrue"}}); Map<String, String> firstFalse = createRow(new String[][]{{"value", "1"}, {"flag", "false"}, {"output", "firstFalse"}}); Map<String, String> secondTrue = createRow(new String[][]{{"value", "2"}, {"flag", "true"}, {"output", "secondTrue"}}); Map<String, String> secondFalse = createRow(new String[][]{{"value", "2"}, {"flag", "false"}, {"output", "secondFalse"}}); Map<String, String> thirdTrue = createRow(new String[][]{{"value", "3"}, {"flag", "true"}, {"output", "thirdTrue"}}); Map<String, String> thirdFalse = createRow(new String[][]{{"value", "3"}, {"flag", "false"}, {"output", "thirdFalse"}}); Table<Integer, String, String> table = createTable(firstTrue, firstFalse, secondTrue, secondFalse, thirdTrue, thirdFalse); assertEquals(null, InlineTableUtil.match(table, createValues(new Object[][]{{"value", "1"}}))); assertEquals(firstTrue, InlineTableUtil.match(table, createValues(new Object[][]{{"value", "1"}, {"flag", "true"}}))); assertEquals(firstFalse, InlineTableUtil.match(table, createValues(new Object[][]{{"value", "1"}, {"flag", false}}))); assertEquals(secondTrue, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 2}, {"flag", "true"}}))); assertEquals(secondFalse, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 2}, {"flag", false}}))); assertEquals(thirdTrue, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 3d}, {"flag", "true"}}))); assertEquals(thirdFalse, InlineTableUtil.match(table, createValues(new Object[][]{{"value", 3d}, {"flag", false}}))); }