@SmallTest
  public void testOnUp() {
    KeyEventButtonTouchListener keyEventButtonTouchListener =
        new KeyEventButtonTouchListener(1, 10);
    KeyEventHandler keyEventHandler = createKeyEventHandlerMock();
    keyEventButtonTouchListener.setKeyEventHandler(keyEventHandler);

    View view = new View(getInstrumentation().getTargetContext());
    view.layout(0, 0, 50, 50);
    Key key = KeyEventButtonTouchListener.createKey(view, 1, 10);
    KeyEventContext keyEventContext =
        new KeyEventContext(key, 0, 0, 0, 0, 100, 100, Collections.<MetaState>emptySet());
    keyEventButtonTouchListener.keyEventContext = keyEventContext;

    keyEventHandler.cancelDelayedKeyEvent(keyEventContext);
    keyEventHandler.sendKey(eq(10), EasyMock.<List<TouchEvent>>notNull());
    keyEventHandler.sendRelease(10);
    replayAll();

    view.setPressed(true);
    keyEventButtonTouchListener.onUp(view, 25, 25, 100);

    verifyAll();
    assertNull(keyEventButtonTouchListener.keyEventContext);
    assertFalse(view.isPressed());
  }
  @Test
  public void testRetrieveFromDriverManager() throws Exception {
    DriverManager.registerDriver(driver);

    EasyMock.expect(driver.connect((String) EasyMock.notNull(), (Properties) EasyMock.notNull()))
        .andReturn(connection);
    connection.setAutoCommit(false);
    connection.setHoldability(1);

    props.put(JdbcDataSource.DRIVER, driver.getClass().getName());
    props.put(JdbcDataSource.URL, "jdbc:fakedb");
    props.put("holdability", "HOLD_CURSORS_OVER_COMMIT");
    mockControl.replay();

    Connection conn = jdbcDataSource.createConnectionFactory(context, props).call();

    mockControl.verify();

    assertSame("connection", conn, connection);
  }
  private void expectDiagnostic(
      Kind kind, String message, @Nullable String source, long start, long end, long col)
      throws IOException {

    expect(diagnostic.getKind()).andReturn(kind);
    expect(diagnostic.getMessage(EasyMock.<Locale>notNull())).andReturn(message);
    expect(diagnostic.getSource()).andReturn(file).anyTimes();
    expect(diagnostic.getStartPosition()).andReturn(start).anyTimes();
    expect(diagnostic.getEndPosition()).andReturn(end).anyTimes();
    expect(diagnostic.getColumnNumber()).andReturn(col).anyTimes();
    expect(file.getCharContent(anyBoolean())).andReturn(source).anyTimes();
  }
 /**
  * Expects not null.
  *
  * @return <code>null</code>.
  */
 protected final <T> T notNull() {
   return EasyMock.<T>notNull();
 }