Ejemplo n.º 1
0
  @Test
  public void testSetFileTypesAsArray() {
    final String[] types1 = new String[] {"text/plain", "image/gif"};

    // Set as array
    WFileWidget widget = new WFileWidget();
    widget.setFileTypes(types1);
    Assert.assertEquals(
        "Incorrect file types returned", Arrays.asList(types1), widget.getFileTypes());
  }
Ejemplo n.º 2
0
  @Test
  public void testSetFileTypesAsNull() {
    WFileWidget widget = new WFileWidget();
    // Set types on widget
    widget.setFileTypes(Arrays.asList("image/jpeg"));

    // Set null array
    widget.setFileTypes((String[]) null);
    Assert.assertEquals(
        "File types should be empty when set to null array",
        Collections.EMPTY_LIST,
        widget.getFileTypes());

    // Set types on widget
    widget.setFileTypes(Arrays.asList("image/jpeg"));

    // Set as null list
    widget.setFileTypes((List<String>) null);
    Assert.assertEquals(
        "File types should be empty when set to null list",
        Collections.EMPTY_LIST,
        widget.getFileTypes());
  }