### Question:
JMXMetricHolder { public Optional<Object> find(String pattern) { JmxPattern jmxPattern = JmxPattern.parse(pattern); return beans.stream() .map(jmxPattern::extract) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }  List<Map<String, Object>> getBeans(); void setBeans(List<Map<String, Object>> beans); @Override String toString(); List<Object> findAll(List<String> properties); Optional<Object> find(String pattern);  }### Answer:
@Test public void testFindSingleBeanByName() throws Exception { assertThat(metrics.find("bean1/value"), is(Optional.of("val1"))); assertThat(metrics.find("bean2/value"), is(Optional.of("val2"))); assertThat(metrics.find("bean3/notfound"), is(Optional.empty())); }