### Question:
LessCompilerScriptService implements ScriptService { public String compileSkinFile(String fileName) { return compileSkinFile(fileName, false); }  String compileSkinFile(String fileName); String compileSkinFile(String fileName, boolean force); String compileSkinFile(String fileName, String skin); String compileSkinFile(String fileName, String skin, boolean force); ColorTheme getColorThemeFromSkinFile(String filename); ColorTheme getColorThemeFromSkinFile(String filename, String skin); boolean clearCache(); boolean clearCacheFromColorTheme(String colorTheme); boolean clearCacheFromSkin(String skin);  }### Answer:
@Test public void compileSkinFile() throws Exception { LESSResourceReference style = mock(LESSResourceReference.class); when(lessResourceReferenceFactory.createReferenceForSkinFile("style.less")).thenReturn(style); mocker.getComponentUnderTest().compileSkinFile("style.less"); verify(lessCompiler).compile(style, false, true, false); LESSResourceReference style2 = mock(LESSResourceReference.class); when(lessResourceReferenceFactory.createReferenceForSkinFile("style2.less")).thenReturn(style2); mocker.getComponentUnderTest().compileSkinFile("style2.less", true); verify(lessCompiler).compile(style2, false, true, true); LESSResourceReference style3 = mock(LESSResourceReference.class); when(lessResourceReferenceFactory.createReferenceForSkinFile("style3.less")).thenReturn(style3); mocker.getComponentUnderTest().compileSkinFile("style3.less", false); verify(lessCompiler).compile(style3, false, true, false); }
@Test public void compileSkinFileWithOtherSkin() throws Exception { LESSResourceReference style = mock(LESSResourceReference.class); when(lessResourceReferenceFactory.createReferenceForSkinFile("style.less")).thenReturn(style); mocker.getComponentUnderTest().compileSkinFile("style.less", "skin1"); verify(lessCompiler).compile(style, false, true, "skin1", false); mocker.getComponentUnderTest().compileSkinFile("style.less", "skin2"); verify(lessCompiler).compile(style, false, true, "skin2", false); mocker.getComponentUnderTest().compileSkinFile("style.less", "skin3", false); verify(lessCompiler).compile(style, false, true, "skin3", false); mocker.getComponentUnderTest().compileSkinFile("style.less", "skin4", true); verify(lessCompiler).compile(style, false, true, "skin4", true); }
@Test public void compileSkinFileWhenException() throws Exception { 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); String result = mocker.getComponentUnderTest().compileSkinFile("style.less", false); assertEquals("LESSCompilerException: Exception with LESS", result); }
@Test public void compileSkinFileWithOtherSkinWhenException() throws Exception { 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, "flamingo", false)).thenThrow(exception); String result = mocker.getComponentUnderTest().compileSkinFile("style.less", "flamingo", false); assertEquals("LESSCompilerException: Exception with LESS", result); }