@Test
  public void testGetValue() {
    WFileWidget widget = new WFileWidget();
    setActiveContext(createUIContext());

    Assert.assertNull("Value should be null by default", widget.getValue());

    // Set file on widget
    widget.setData(TEST_FILE_ITEM_WRAP);
    Assert.assertEquals(
        "Incorrect file item wrap returned", TEST_FILE_ITEM_WRAP, widget.getValue());
  }
  @Test
  public void testDoHandleRequest() {
    WFileWidget widget = new WFileWidget();
    setActiveContext(createUIContext());

    // Request - with file (changed)
    MockRequest request = setupFileUploadRequest(widget, TEST_FILE_ITEM);
    boolean changed = widget.doHandleRequest(request);

    Assert.assertTrue("Request With File - Widget should have changed", changed);
    Assert.assertEquals(
        "Request With File - Incorrect file item returned",
        TEST_FILE_ITEM.getName(),
        widget.getValue().getName());

    // Request - with same file (still change as any file uploaded is a change)
    request = setupFileUploadRequest(widget, TEST_FILE_ITEM);
    changed = widget.doHandleRequest(request);

    Assert.assertTrue(
        "Request With Same File - Widget should have changed as any file upload is considered a change",
        changed);
    Assert.assertEquals(
        "Request With Same File - Incorrect file item returned",
        TEST_FILE_ITEM.getName(),
        widget.getValue().getName());

    // Request - with different file (change)
    request = setupFileUploadRequest(widget, TEST_FILE_ITEM2);
    changed = widget.doHandleRequest(request);

    Assert.assertTrue("Request With Different File - Widget should have changed", changed);
    Assert.assertEquals(
        "Request With Different File - Incorrect file item returned",
        TEST_FILE_ITEM2.getName(),
        widget.getValue().getName());

    // Request - no file (change)
    request = setupFileUploadRequest(widget, TEST_EMPTY_FILE_ITEM);
    changed = widget.doHandleRequest(request);

    Assert.assertTrue("Request With Empty File - Widget should have changed", changed);
    Assert.assertNull("Request With Empty File - Incorrect file item returned", widget.getValue());

    // Request - no file (no change)
    request = setupFileUploadRequest(widget, TEST_EMPTY_FILE_ITEM);
    changed = widget.doHandleRequest(request);

    Assert.assertFalse("Request With Empty File - Widget should have not changed", changed);
    Assert.assertNull("Request With Empty File - Incorrect file item returned", widget.getValue());
  }