CssBackgroundUtils { public static String getBackgroundPropertyNameFromType(BackgroundPropertyType propertyType) { switch (propertyType) { case BACKGROUND_COLOR: return CommonCssConstants.BACKGROUND_COLOR; case BACKGROUND_IMAGE: return CommonCssConstants.BACKGROUND_IMAGE; case BACKGROUND_POSITION: return CommonCssConstants.BACKGROUND_POSITION; case BACKGROUND_POSITION_X: return CommonCssConstants.BACKGROUND_POSITION_X; case BACKGROUND_POSITION_Y: return CommonCssConstants.BACKGROUND_POSITION_Y; case BACKGROUND_SIZE: return CommonCssConstants.BACKGROUND_SIZE; case BACKGROUND_REPEAT: return CommonCssConstants.BACKGROUND_REPEAT; case BACKGROUND_ORIGIN: return CommonCssConstants.BACKGROUND_ORIGIN; case BACKGROUND_CLIP: return CommonCssConstants.BACKGROUND_CLIP; case BACKGROUND_ATTACHMENT: return CommonCssConstants.BACKGROUND_ATTACHMENT; default: return CommonCssConstants.UNDEFINED_NAME; } } private  CssBackgroundUtils(); static String getBackgroundPropertyNameFromType(BackgroundPropertyType propertyType); static BackgroundPropertyType resolveBackgroundPropertyType(final String value);  }
@Test public void getBackgroundPropertyNameFromType() { Assert.assertEquals(CommonCssConstants.BACKGROUND_COLOR, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_COLOR)); Assert.assertEquals(CommonCssConstants.BACKGROUND_IMAGE, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_IMAGE)); Assert.assertEquals(CommonCssConstants.BACKGROUND_CLIP, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_CLIP)); Assert.assertEquals(CommonCssConstants.BACKGROUND_ORIGIN, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_ORIGIN)); Assert.assertEquals(CommonCssConstants.BACKGROUND_POSITION, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_POSITION)); Assert.assertEquals(CommonCssConstants.BACKGROUND_REPEAT, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_REPEAT)); Assert.assertEquals(CommonCssConstants.BACKGROUND_SIZE, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_SIZE)); Assert.assertEquals(CommonCssConstants.BACKGROUND_ATTACHMENT, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_ATTACHMENT)); Assert.assertEquals(CommonCssConstants.UNDEFINED_NAME, CssBackgroundUtils.getBackgroundPropertyNameFromType(CssBackgroundUtils.BackgroundPropertyType.UNDEFINED)); }