### Question:
CpkCoreService { String getLocalizationResource( String elementId, String resource ) throws Exception { if ( !hasElement( elementId ) ) { throw new Exception( "Element \"" + elementId + "\" does not exist." ); } final String dashboardRelativePath = getElementRelativePath( elementId ); final Collection<File> resourceList = getPluginUtils().getPluginResources( dashboardRelativePath, true, resource ); if ( resourceList.isEmpty() ) { throw new FileNotFoundException(); } final File localizationResource = (File) resourceList.toArray()[ 0 ]; return localizationResource.getPath(); } CpkCoreService( ICpkEnvironment environment ); CpkEngine getEngine(); CpkCoreService setEngine( CpkEngine engine ); void createContent( Map<String, Map<String, Object>> bloatedMap ); String getLocalizationResourceContent( String elementId, String resource ); void reload( OutputStream out, Map<String, Map<String, Object>> bloatedMap ); String reload( Map<String, Map<String, Object>> bloatedMap ); void refresh( OutputStream out, Map<String, Map<String, Object>> bloatedMap ); String refresh( Map<String, Map<String, Object>> bloatedMap ); void clearKettleResultsCache(); void status( OutputStream out, Map<String, Map<String, Object>> bloatedMap ); String status( Map<String, Map<String, Object>> bloatedMap ); void statusJson( OutputStream out, HttpServletResponse response ); String statusJson( HttpServletResponse response ); boolean hasElement( String elementId ); Collection<IElement> getElements(); void getElementsList( OutputStream out, Map<String, Map<String, Object>> bloatedMap ); String getElementsList(); IElement getDefaultElement(); RestRequestHandler getRequestHandler();  }### Answer:
@Test public void testGetLocalizationResource() throws Exception { final String localizationResource = "messages_supported_languages.properties"; final String relativeLocation = "path/to"; final String elementId = "bar"; doReturn( true ).when( cpkCore ).hasElement( eq( elementId ) ); doReturn( relativeLocation ).when( cpkCore ).getElementRelativePath( eq( elementId ) ); IPluginUtils pluginUtilsMock = mock( IPluginUtils.class ); File localizationFile = mock( File.class ); String expectedPath = relativeLocation + "/" + localizationResource; doReturn( expectedPath ).when( localizationFile ).getPath(); doReturn( Collections.singleton( localizationFile ) ).when( pluginUtilsMock ) .getPluginResources( eq( relativeLocation ), eq( true ), eq( localizationResource ) ); doReturn( pluginUtilsMock ).when( cpkCore ).getPluginUtils(); final String actualPath = cpkCore.getLocalizationResource( elementId, localizationResource ); assertEquals( expectedPath, actualPath ); }