Source:
<code><START> public void ContentFallbackFalse_PageFallbackFalse_PageEnglish_ViewEnglishContent1And2_ViewSpanish404(final Container container, final Template template) throws Exception{ <END> Config.setProperty(contentFallbackProperty,false); Config.setProperty(pageFallbackProperty,false); final String pageName = "test4Page-"+System.currentTimeMillis(); final HTMLPageAsset pageEnglishVersion = createHtmlPageAsset(template, pageName, 1); createMultiTree(pageEnglishVersion.getIdentifier(), container.getIdentifier()); HttpServletRequest mockRequest = new MockSessionRequest( new MockAttributeRequest(new MockHttpRequest("localhost", "/").request()).request()) .request(); Mockito.when(mockRequest.getParameter("host_id")).thenReturn(site.getIdentifier()); mockRequest.setAttribute(WebKeys.HTMLPAGE_LANGUAGE, "1"); HttpServletRequestThreadLocal.INSTANCE.setRequest(mockRequest); final HttpServletResponse mockResponse = mock(HttpServletResponse.class); String html = APILocator.getHTMLPageAssetRenderedAPI().getPageHtml( PageContextBuilder.builder() .setUser(systemUser) .setPageUri(pageEnglishVersion.getURI()) .setPageMode(PageMode.LIVE) .build(), mockRequest, mockResponse); Assert.assertTrue("ENG = "+html , html.contains("content2content1")); mockRequest = new MockSessionRequest( new MockAttributeRequest(new MockHttpRequest("localhost", "/").request()).request()) .request(); mockRequest .setAttribute(WebKeys.HTMLPAGE_LANGUAGE, String.valueOf(spanishLanguage.getId())); HttpServletRequestThreadLocal.INSTANCE.setRequest(mockRequest); html = APILocator.getHTMLPageAssetRenderedAPI().getPageHtml( PageContextBuilder.builder() .setUser(systemUser) .setPageUri(pageEnglishVersion.getURI()) .setPageMode(PageMode.LIVE) .build(), mockRequest, mockResponse); }</code><technical_language>![Codacy](<LINK_0> Issue found: [A method/constructor explicitly throw java.lang.Exception](<LINK_1></technical_language>

Target:
public void ContentFallbackFalse_PageFallbackFalse_PageEnglish_ViewEnglishContent1And2_ViewSpanish404(final Container container, final Template template) throws Exception{ Config.setProperty(contentFallbackProperty,false); Config.setProperty(pageFallbackProperty,false); final String pageName = "test4Page-"+System.currentTimeMillis(); final HTMLPageAsset pageEnglishVersion = createHtmlPageAsset(template, pageName, 1); createMultiTree(pageEnglishVersion.getIdentifier(), container.getIdentifier()); HttpServletRequest mockRequest = new MockSessionRequest( new MockAttributeRequest(new MockHttpRequest("localhost", "/").request()).request()) .request(); Mockito.when(mockRequest.getParameter("host_id")).thenReturn(site.getIdentifier()); mockRequest.setAttribute(WebKeys.HTMLPAGE_LANGUAGE, "1"); HttpServletRequestThreadLocal.INSTANCE.setRequest(mockRequest); final HttpServletResponse mockResponse = mock(HttpServletResponse.class); String html = APILocator.getHTMLPageAssetRenderedAPI().getPageHtml( PageContextBuilder.builder() .setUser(systemUser) .setPageUri(pageEnglishVersion.getURI()) .setPageMode(PageMode.LIVE) .build(), mockRequest, mockResponse); Assert.assertTrue("ENG = "+html , html.contains("content2content1")); mockRequest = new MockSessionRequest( new MockAttributeRequest(new MockHttpRequest("localhost", "/").request()).request()) .request(); mockRequest .setAttribute(WebKeys.HTMLPAGE_LANGUAGE, String.valueOf(spanishLanguage.getId())); HttpServletRequestThreadLocal.INSTANCE.setRequest(mockRequest); try { APILocator.getHTMLPageAssetRenderedAPI().getPageHtml( PageContextBuilder.builder() .setUser(systemUser) .setPageUri(pageEnglishVersion.getURI()) .setPageMode(PageMode.LIVE) .build(), mockRequest, mockResponse); throw new AssertionError("HTMLPageAssetNotFoundException expected"); }catch(HTMLPageAssetNotFoundException e) { } }