/******************************************************************************* * Copyright (c) 2009, 2016 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ua.tests.help.webapp; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.servlet.http.HttpServletRequest; import org.eclipse.help.internal.webapp.servlet.PluginsRootResolvingStream; import org.junit.Test; /** * Test for text matching when inserting links */ public class ChildLinkInsertion { private class TestableReplacementStream extends PluginsRootResolvingStream { public TestableReplacementStream(OutputStream out, HttpServletRequest req, String prefix) { super(out, req, prefix); } @Override protected void insertBasedOnKeyword(int index) throws IOException { if (index == 0 ) { out.write("".getBytes()); //$NON-NLS-1$ } else if (index == 1) { out.write("