### Question:
FluentBy extends By { public static ByLast last(By by) { if (by instanceof ByAttribute) { return new ByLast((ByAttribute) by); } throw new UnsupportedOperationException("last() not allowed for " + by.getClass().getName() + " type"); }  void beforeFindElement(WebDriver driver); static ByStrictClassName strictClassName(final String className); static ByAttribute attribute(final String name); static ByAttribute attribute(final String name, final String value); static ByAttribute notAttribute(final String name); static ByComposite composite(By.ByTagName b0, By.ByClassName b1); static ByComposite composite(By.ByTagName b0, FluentBy.ByAttribute b1); static ByLast last(By by); static ByLast last();  }### Answer:
@Test public void last() throws IllegalAccessException { FindsByXPathSearchContext context = mock(FindsByXPathSearchContext.class); WebElement we = mock(WebElement.class); By lastFooBar = FluentBy.last(); assertThat(lastFooBar.toString(), is("FluentBy.last()")); when(context.findElementByXPath(". WebElement lastBar = lastFooBar.findElement(context); assertThat(lastBar, is(we)); }