public static BlendMode getInstance(COSBase cosBlendMode)
    {
        BlendMode result = null;
        if (cosBlendMode instanceof COSName)
        {
            result = BLEND_MODES.get(cosBlendMode);
        }
        else if (cosBlendMode instanceof COSArray)
        {
            COSArray cosBlendModeArray = (COSArray) cosBlendMode;
            for (int i = 0; i < cosBlendModeArray.size(); i++)
            {
                COSBase cosBase = cosBlendModeArray.getObject(i);
                if (cosBase instanceof COSName)
                {
                    result = BLEND_MODES.get(cosBase);
                    if (result != null)
                    {
                        break;
                    }
                }
            }
        }
        return result != null ? result : BlendMode.NORMAL;
    }
@Test
    void testInstances()
    {
        assertEquals(BlendMode.NORMAL, BlendMode.getInstance(COSName.NORMAL));
        assertEquals(BlendMode.NORMAL, BlendMode.getInstance(COSName.COMPATIBLE));
        assertEquals(BlendMode.MULTIPLY, BlendMode.getInstance(COSName.MULTIPLY));
        assertEquals(BlendMode.SCREEN, BlendMode.getInstance(COSName.SCREEN));
        assertEquals(BlendMode.OVERLAY, BlendMode.getInstance(COSName.OVERLAY));
        assertEquals(BlendMode.DARKEN, BlendMode.getInstance(COSName.DARKEN));
        assertEquals(BlendMode.LIGHTEN, BlendMode.getInstance(COSName.LIGHTEN));
        assertEquals(BlendMode.COLOR_DODGE, BlendMode.getInstance(COSName.COLOR_DODGE));
        assertEquals(BlendMode.COLOR_BURN, BlendMode.getInstance(COSName.COLOR_BURN));
        assertEquals(BlendMode.HARD_LIGHT, BlendMode.getInstance(COSName.HARD_LIGHT));
        assertEquals(BlendMode.SOFT_LIGHT, BlendMode.getInstance(COSName.SOFT_LIGHT));
        assertEquals(BlendMode.DIFFERENCE, BlendMode.getInstance(COSName.DIFFERENCE));
        assertEquals(BlendMode.EXCLUSION, BlendMode.getInstance(COSName.EXCLUSION));
        assertEquals(BlendMode.HUE, BlendMode.getInstance(COSName.HUE));
        assertEquals(BlendMode.SATURATION, BlendMode.getInstance(COSName.SATURATION));
        assertEquals(BlendMode.LUMINOSITY, BlendMode.getInstance(COSName.LUMINOSITY));
        assertEquals(BlendMode.COLOR, BlendMode.getInstance(COSName.COLOR));

        COSArray cosArrayOverlay = new COSArray();
        cosArrayOverlay.add(COSName.OVERLAY);
        assertEquals(BlendMode.OVERLAY, BlendMode.getInstance(cosArrayOverlay));

        COSArray cosArrayInteger = new COSArray();
        cosArrayInteger.add(COSInteger.get(0));
        assertEquals(BlendMode.NORMAL, BlendMode.getInstance(cosArrayInteger));

    }