### Question:
TagMatchUtility { static boolean matchesTag(Tag tag, TagQuery tagQuery) { return matches(tag.getName(), tagQuery.getNameRegex()) && matches(tag.getValue(), tagQuery.getValueRegex()); }  static boolean matchesAllTagQueries(Specification specification, List<TagQuery> tagQueries);  }### Answer:
@Test public void matchesTag_nameAndValue() { assertTrue(matchesTag( new Tag("name", "value"), TagQuery.builder().nameRegex("name").valueRegex("value").build() )); }
@Test public void matchesTag_nameOnly() { assertTrue(matchesTag( new Tag("name", null), TagQuery.builder().nameRegex("name").build() )); }
@Test public void matchesTag_valueDoesNotMatch() { assertFalse(matchesTag( new Tag("name", "value"), TagQuery.builder().nameRegex("name").valueRegex("x").build() )); }
@Test public void matchesTag_nameDoesNotMatch() { assertFalse(matchesTag( new Tag("name", null), TagQuery.builder().nameRegex("x").build() )); }