/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package io.github.bonigarcia.test.unit;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.lang.reflect.Parameter;
import java.util.Optional;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;

import io.github.bonigarcia.handler.FirefoxDriverHandler;
import io.github.bonigarcia.test.advance.FirefoxWithOptionsJupiterTest;
import io.github.bonigarcia.test.mockito.MockitoExtension;

@ExtendWith(MockitoExtension.class)
public class FirefoxAnnotationReaderTest {

    @InjectMocks
    FirefoxDriverHandler annotationsReader;

    @Test
    void testFirefoxOptions() throws Exception {
        Parameter parameter = FirefoxWithOptionsJupiterTest.class
                .getMethod("webrtcFirefoxTest", FirefoxDriver.class)
                .getParameters()[0];
        FirefoxOptions firefoxOptions = annotationsReader
                .getFirefoxOptions(parameter, Optional.empty());

        assertTrue(firefoxOptions.getProfile().getBooleanPreference(
                "media.navigator.permission.disabled", false));
        assertTrue(firefoxOptions.getProfile()
                .getBooleanPreference("media.navigator.streams.fake", false));
    }

}

@@ -723,16 +723,90 @@
 ertTrue;
+%0Aimport static org.openqa.selenium.firefox.FirefoxOptions.FIREFOX_OPTIONS;
 %0A%0Aimport
@@ -831,24 +831,46 @@
 .Parameter;%0A
+import java.util.Map;%0A
 import java.
@@ -1447,16 +1447,51 @@
   @Test%0A
+    @SuppressWarnings(%22unchecked%22)%0A
     void
@@ -1826,25 +1826,24 @@
 pty());%0A
-%0A
         
 assertTr
@@ -1838,68 +1838,190 @@
     
-assertTrue(firefoxOptions.getProfile().getBooleanPreference(
+Map%3CString, Map%3CString, Boolean%3E%3E options = (Map%3CString, Map%3CString, Boolean%3E%3E) firefoxOptions%0A                .asMap().get(FIREFOX_OPTIONS);%0A%0A        assertTrue(options.get(%22prefs%22)
 %0A   
@@ -2033,16 +2033,21 @@
         
+.get(
 %22media.n
@@ -2075,23 +2075,16 @@
 isabled%22
-, false
 ));%0A    
@@ -2098,24 +2098,17 @@
 ertTrue(
-firefoxO
+o
 ptions.g
@@ -2113,55 +2113,21 @@
 .get
-Profile()%0A                .getBooleanPreference
+(%22prefs%22).get
 (%22me
@@ -2157,15 +2157,8 @@
 ake%22
-, false
 ));%0A

Fix annotation reader test due to selenium upgrade