/******************************************************************************* * Copyright (c) 2012-2017 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Codenvy, S.A. - initial API and implementation *******************************************************************************/ package org.eclipse.che.commons.test.servlet; import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; import java.io.IOException; import java.io.InputStream; /** Utility class for mocking {@link ServletInputStream} */ public class MockServletInputStream extends ServletInputStream { private final InputStream data; public MockServletInputStream(InputStream data) { this.data = data; } @Override public int read() throws IOException { return this.data.read(); } @Override public boolean isFinished() { return false; } @Override public boolean isReady() { return false; } @Override public void setReadListener(ReadListener readListener) { } }