package com.foxx.androidcast.display;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ExternalDisplayCapturePolicyTest {

    @Test
    public void fromName_valid() {
        assertEquals(ExternalDisplayCapturePolicy.PREFER_EXTERNAL_WHEN_PRESENT,
                ExternalDisplayCapturePolicy.fromName("PREFER_EXTERNAL_WHEN_PRESENT",
                        ExternalDisplayCapturePolicy.DEFAULT_DISPLAY_ONLY));
    }

    @Test
    public void fromName_invalidFallsBack() {
        assertEquals(ExternalDisplayCapturePolicy.DEFAULT_DISPLAY_ONLY,
                ExternalDisplayCapturePolicy.fromName("NOPE",
                        ExternalDisplayCapturePolicy.DEFAULT_DISPLAY_ONLY));
    }

    @Test
    public void implementationNote_nonEmpty() {
        for (ExternalDisplayCapturePolicy p : ExternalDisplayCapturePolicy.values()) {
            assertTrue(p.implementationNote().length() > 5);
        }
    }
}
