package com.sdl.weblocator.bootstrap.form;

import com.sdl.selenium.bootstrap.form.Form;
import com.sdl.selenium.bootstrap.form.MultiSelect;
import com.sdl.weblocator.InputData;
import com.sdl.weblocator.TestBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.testng.Assert.assertTrue;

public class MultiSelectTest extends TestBase {
    private static final Logger LOGGER = LoggerFactory.getLogger(MultiSelectTest.class);

    private Form form = new Form(null, "Form Title");
    private MultiSelect multiSelect = new MultiSelect(form, "Source:");

    @BeforeClass
    public void startTests() {
        driver.get(InputData.BOOTSTRAP_URL);
    }

    @Test
    public void selectTwo() {
        assertTrue(multiSelect.select("Cheese", "Tomatoes"));
        List<String> list = multiSelect.getValueSelected();
        assertThat(list, contains(Arrays.asList("Cheese", "Tomatoes").toArray()));
    }

    @Test (dependsOnMethods = "selectTwo")
    public void selectAll() {
        assertTrue(multiSelect.select("Select all"));
        List<String> list = multiSelect.getValueSelected();
        assertThat(list, contains(Arrays.asList("Cheese", "Tomatoes", "Mozzarella", "Mushrooms", "Pepperoni", "Onions", "Carrots").toArray()));
    }
}

@@ -530,32 +530,28 @@
 org.
-testng.Assert.assertTrue
+hamcrest.Matchers.is
 ;%0D%0A%0D
@@ -976,35 +976,35 @@
 %0A        assertT
-rue
+hat
 (multiSelect.sel
@@ -1028,16 +1028,26 @@
 matoes%22)
+, is(true)
 );%0D%0A    
@@ -1286,19 +1286,19 @@
  assertT
-rue
+hat
 (multiSe
@@ -1322,16 +1322,26 @@
 ct all%22)
+, is(true)
 );%0D%0A    

add last version of webdriver