package org.wso2.carbon.device.mgt.ios.payload.beans;

import org.testng.Assert;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.ios.payload.dto.PayloadOperationWrapper;
import org.wso2.carbon.device.mgt.ios.payload.exception.PListException;
import org.wso2.carbon.device.mgt.ios.payload.exception.ProfileConfigurationException;
import org.wso2.carbon.device.mgt.ios.payload.operation.WebClipOperations;

public class WebClipTestSuite {

    @Test(expectedExceptions = ProfileConfigurationException.class)
    public void testEmptyURL() throws ProfileConfigurationException {

        WebClip webClip = new WebClip();
        webClip.setURL("");
        webClip.validateRequest();

    }

    @Test(expectedExceptions = ProfileConfigurationException.class)
    public void testEmptyLabel() throws ProfileConfigurationException {

        WebClip webClip = new WebClip();
        webClip.setURL("url");
        webClip.setLabel("");
        webClip.validateRequest();

    }

    @Test
    public void testWebClipPayload() throws ProfileConfigurationException, PListException {

        WebClip webClip = new WebClip();
        webClip.setURL("url");
        webClip.setLabel("label");
        webClip.setIcon(null);
        webClip.setIsRemovable(true);
        webClip.setIsFullscreen(true);
        webClip.setIsPrecomposed(true);
        webClip.validateRequest();

        WebClipOperations webClipOperations = new WebClipOperations();
        PayloadOperationWrapper payload = webClipOperations.createWebClipPayload(webClip);

        Assert.assertNotNull(payload);

    }
}
