Skip to content

Commit

Permalink
FORGE-2524: Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Nov 3, 2015
1 parent 947551b commit edcf67b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@

package org.jboss.forge.addon.ui.input;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItem;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import javax.inject.Inject;

import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.addon.convert.ConverterFactory;
import org.jboss.forge.addon.ui.util.InputComponents;
import org.jboss.forge.furnace.util.Lists;
import org.jboss.forge.furnace.util.OperatingSystemUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -25,6 +32,9 @@
@RunWith(Arquillian.class)
public class InputComponentsTest
{
@Inject
private UIInputMany<File> files;

@Inject
private UISelectOne<String> values;

Expand All @@ -38,4 +48,13 @@ public void testUISelectOneShouldNotSetValueNotContainedInValueChoices()
InputComponents.setValueFor(converterFactory, values, "D");
Assert.assertNull(values.getValue());
}

@Test
public void testUIInputManyFileSingleList()
{
InputComponents.setValueFor(converterFactory, files, OperatingSystemUtils.getTempDirectory());
List<File> list = Lists.toList(files.getValue());
Assert.assertThat(list.size(), equalTo(1));
Assert.assertThat(list, hasItem(OperatingSystemUtils.getTempDirectory()));
}
}

0 comments on commit edcf67b

Please sign in to comment.