### Question:
PerformanceTimingMetricsFactory { @SuppressWarnings("unchecked") public PerformanceTimingMetrics createFor(Object performanceTiming) { PerformanceTimingMetrics metrics; if (performanceTiming instanceof Map) { metrics = new DefaultPerformanceTimingMetrics((Map<String, Object>) performanceTiming); } else if (performanceTiming instanceof PerformanceTiming) { metrics = new HtmlUnitPerformanceTimingMetrics((PerformanceTiming) performanceTiming); } else { throw new UnknownPerformanceTimingImplementationException("There is no suitable adapter implementation" + " for the argument performance timing object." + "\n" + "Please create a GitHub issue for FluentLenium" + " if you think that browser/implementation should be supported." + "\n" + "The object was of type: " + performanceTiming.getClass() + " with value: " + performanceTiming); } return metrics; }  @SuppressWarnings("unchecked") PerformanceTimingMetrics createFor(Object performanceTiming);  }### Answer:
@Test public void shouldCreateDefaultMetricsFactory() { Map<String, Object> timingObject = new HashMap<>(); timingObject.put(PerformanceTimingEvent.SECURE_CONNECTION_START.getEvent(), 150000L); timingObject.put(PerformanceTimingEvent.NAVIGATION_START.getEvent(), 27500L); assertThat(factory.createFor(timingObject)).isInstanceOf(DefaultPerformanceTimingMetrics.class); }
@Test public void shouldCreateHtmlUnitMetricsFactory() { PerformanceTiming htmlUnitPerformanceTiming = new PerformanceTiming(); assertThat(factory.createFor(htmlUnitPerformanceTiming)).isInstanceOf(HtmlUnitPerformanceTimingMetrics.class); }
@Test public void shouldThrowExceptionForUnknownImplementation() { assertThatExceptionOfType(UnknownPerformanceTimingImplementationException.class) .isThrownBy(() -> factory.createFor(Arrays.asList("some", "value"))) .withMessageContaining("The object was of type: class java.util.Arrays$ArrayList" + " with value: [some, value]"); }