Removed changes to master branch meant for another branch.

This commit is contained in:
LC24
2021-11-21 13:53:10 -06:00
parent c83d329c5a
commit 97688b38e6
2 changed files with 0 additions and 35 deletions
@@ -34,22 +34,6 @@ public class Options {
}
/**
* returns the same as option with null as an added possibility
* @param value The varargs to take a random element from.
* @param <E> The type of the elements in the varargs.
* @return A randomly selected element from the varargs.
*/
public <E> E randomlyNull(E... value) {
List<E> elements;
elements = new ArrayList<>(value.length);
for (int i = 0; i < value.length; i++) {
elements.add(i, value[i]);
}
elements.add(value.length, null);
return faker.options().option((E[]) elements.toArray());
}
/**
* Returns a random element from an array.
*
@@ -35,25 +35,6 @@ public class OptionsTest extends AbstractFakerTest {
assertThat(faker.options().option(1, 3, 4, 5), isOneOf(integerOptions));
}
@Test
public void testRandomlyNull() {
Integer[] int_list = new Integer[] {1,3,4,5,21,13,45};
Integer[] int_list_check = new Integer[] {1,3,4,5,21,13,45,null};
String[] string_list = new String[] {"hello", "Goodbye", "Hi", "near", "far"};
String[] string_list_check = new String[] {"hello", "Goodbye", "Hi", "near", "far", null};
for (int i = 0; i < int_list.length; i++) {
Integer temp = faker.options().randomlyNull(int_list);
assertThat( temp, isOneOf(int_list_check));
}
for (int i = 0; i < string_list.length; i++) {
String temp = faker.options().randomlyNull(string_list);
assertThat( temp, isOneOf(string_list_check));
}
}
@Test
public void testOptionWithEnum() {
assertThat(faker.options().option(Day.class), isOneOf(Day.values()));