use of org.xwiki.lesscss.resources.LESSResourceReference in project xwiki-platform by xwiki.
the class LessCompilerScriptServiceTest method compileSkinFileWhenException.
@Test
public void compileSkinFileWhenException() throws Exception {
// Mocks
LESSResourceReference style = mock(LESSResourceReference.class);
when(lessResourceReferenceFactory.createReferenceForSkinFile("style.less")).thenReturn(style);
Exception exception = new LESSCompilerException("Exception with LESS", null);
when(lessCompiler.compile(style, false, true, false)).thenThrow(exception);
// Test
String result = mocker.getComponentUnderTest().compileSkinFile("style.less", false);
// Verify
assertEquals("LESSCompilerException: Exception with LESS", result);
}
use of org.xwiki.lesscss.resources.LESSResourceReference in project xwiki-platform by xwiki.
the class LessCompilerScriptServiceTest method compileSkinFile.
@Test
public void compileSkinFile() throws Exception {
// Mock
LESSResourceReference style = mock(LESSResourceReference.class);
when(lessResourceReferenceFactory.createReferenceForSkinFile("style.less")).thenReturn(style);
// Test
mocker.getComponentUnderTest().compileSkinFile("style.less");
// Verify
verify(lessCompiler).compile(style, false, true, false);
// Mock
LESSResourceReference style2 = mock(LESSResourceReference.class);
when(lessResourceReferenceFactory.createReferenceForSkinFile("style2.less")).thenReturn(style2);
// Test
mocker.getComponentUnderTest().compileSkinFile("style2.less", true);
// Verify
verify(lessCompiler).compile(style2, false, true, true);
// Mock
LESSResourceReference style3 = mock(LESSResourceReference.class);
when(lessResourceReferenceFactory.createReferenceForSkinFile("style3.less")).thenReturn(style3);
// Test
mocker.getComponentUnderTest().compileSkinFile("style3.less", false);
// Verify
verify(lessCompiler).compile(style3, false, true, false);
}
use of org.xwiki.lesscss.resources.LESSResourceReference in project xwiki-platform by xwiki.
the class CacheKeyFactoryTest method getCacheKeyWithContext.
@Test
public void getCacheKeyWithContext() throws Exception {
// Mocks
LESSResourceReference lessResource = mock(LESSResourceReference.class);
SkinReference skin = mock(SkinReference.class);
ColorThemeReference colorTheme = mock(ColorThemeReference.class);
when(lessResource.serialize()).thenReturn("lessResource");
when(skin.serialize()).thenReturn("skin");
when(colorTheme.serialize()).thenReturn("colorTheme");
when(xcontextCacheKeyFactory.getCacheKey()).thenReturn("XWikiContext[Mock]");
// Test
assertEquals("12_lessResource_4_skin_10_colorTheme_18_XWikiContext[Mock]", mocker.getComponentUnderTest().getCacheKey(lessResource, skin, colorTheme, true));
}
use of org.xwiki.lesscss.resources.LESSResourceReference in project xwiki-platform by xwiki.
the class CacheKeyFactoryTest method getCacheKeyWithoutContext.
@Test
public void getCacheKeyWithoutContext() throws Exception {
// Mocks
LESSResourceReference lessResource = mock(LESSResourceReference.class);
SkinReference skin = mock(SkinReference.class);
ColorThemeReference colorTheme = mock(ColorThemeReference.class);
when(lessResource.serialize()).thenReturn("lessResource");
when(skin.serialize()).thenReturn("skin");
when(colorTheme.serialize()).thenReturn("colorTheme");
// Test
assertEquals("12_lessResource_4_skin_10_colorTheme", mocker.getComponentUnderTest().getCacheKey(lessResource, skin, colorTheme, false));
}
Aggregations