![JAR search and dependency download from the Maven repository](/logo.png)
org.eclipse.jgit.junit.http.MockServletConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.jgit.junit.http Show documentation
Show all versions of org.eclipse.jgit.junit.http Show documentation
Utility classes to support Http based JUnit testing of JGit applications.
The newest version!
/*
* Copyright (C) 2010, Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.junit.http;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
/**
* Mock ServletConfig
*/
public class MockServletConfig implements ServletConfig {
private final Map parameters = new HashMap<>();
/**
* Set init parameter.
*
* @param name
* parameter name
* @param value
* parameter value
*/
public void setInitParameter(String name, String value) {
parameters.put(name, value);
}
@Override
public String getInitParameter(String name) {
return parameters.get(name);
}
@Override
public Enumeration getInitParameterNames() {
final Iterator i = parameters.keySet().iterator();
return new Enumeration<>() {
@Override
public boolean hasMoreElements() {
return i.hasNext();
}
@Override
public String nextElement() {
return i.next();
}
};
}
@Override
public String getServletName() {
return "MOCK_SERVLET";
}
@Override
public ServletContext getServletContext() {
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy