package com.getcapacitor;

import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;

import br.com.era6.capacitor.navigation.bar.CapacitorNavigationBarPlugin;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class CapacitorNavigationBarPluginUnitTest {

    private CapacitorNavigationBarPlugin capacitorNavigationBarPlugin;

    @Before
    public void setUp() {
        capacitorNavigationBarPlugin = new CapacitorNavigationBarPlugin();
    }

    @Test
    public void setStyle_withNullValue() throws Exception {
        PluginCall pluginCall = spy(new PluginCall(mock(MessageHandler.class), null, null, null, new JSObject("{ style: null }")));
        capacitorNavigationBarPlugin.setStyle(pluginCall);
        verify(pluginCall).error("Style must be provided");
    }

    @Test
    public void setBackgroundColor_withNullValue() throws Exception {
        PluginCall pluginCall = spy(new PluginCall(mock(MessageHandler.class), null, null, null, new JSObject("{ color: null }")));
        capacitorNavigationBarPlugin.setBackgroundColor(pluginCall);
        verify(pluginCall).error("Color must be provided");
    }
}