Add unit tests for utility methods

This commit is contained in:
Joe Farebrother
2021-02-15 15:21:27 +00:00
parent e5d624d1e8
commit cf58a90d74
9 changed files with 426 additions and 25 deletions

View File

@@ -0,0 +1,65 @@
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.message;
import java.io.Serializable;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.ParseException;
public class BasicHeader implements Header, Cloneable, Serializable {
public BasicHeader(final String name, final String value) {
}
@Override
public Object clone() throws CloneNotSupportedException {
return null;
}
@Override
public HeaderElement[] getElements() throws ParseException {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public String getValue() {
return null;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,78 @@
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.util;
import java.util.Collection;
public class Args {
public static void check(final boolean expression, final String message) {
}
public static void check(final boolean expression, final String message, final Object... args) {
}
public static void check(final boolean expression, final String message, final Object arg) {
}
public static <T> T notNull(final T argument, final String name) {
return null;
}
public static <T extends CharSequence> T notEmpty(final T argument, final String name) {
return null;
}
public static <T extends CharSequence> T notBlank(final T argument, final String name) {
return null;
}
public static <T extends CharSequence> T containsNoBlanks(final T argument, final String name) {
return null;
}
public static <E, T extends Collection<E>> T notEmpty(final T argument, final String name) {
return null;
}
public static int positive(final int n, final String name) {
return 0;
}
public static long positive(final long n, final String name) {
return 0;
}
public static int notNegative(final int n, final String name) {
return 0;
}
public static long notNegative(final long n, final String name) {
return 0;
}
}

View File

@@ -0,0 +1,93 @@
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.util;
import java.io.Serializable;
public final class ByteArrayBuffer implements Serializable {
public ByteArrayBuffer(final int capacity) {
}
public void append(final byte[] b, final int off, final int len) {
}
public void append(final int b) {
}
public void append(final char[] b, final int off, final int len) {
}
public void append(final CharArrayBuffer b, final int off, final int len) {
}
public void clear() {
}
public byte[] toByteArray() {
return null;
}
public int byteAt(final int i) {
return 0;
}
public int capacity() {
return 0;
}
public int length() {
return 0;
}
public void ensureCapacity(final int required) {
}
public byte[] buffer() {
return null;
}
public void setLength(final int len) {
}
public boolean isEmpty() {
return false;
}
public boolean isFull() {
return false;
}
public int indexOf(final byte b, final int from, final int to) {
return 0;
}
public int indexOf(final byte b) {
return 0;
}
}

View File

@@ -0,0 +1,127 @@
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.util;
import java.io.Serializable;
import java.nio.CharBuffer;
public final class CharArrayBuffer implements CharSequence, Serializable {
public CharArrayBuffer(final int capacity) {
}
public void append(final char[] b, final int off, final int len) {
}
public void append(final String str) {
}
public void append(final CharArrayBuffer b, final int off, final int len) {
}
public void append(final CharArrayBuffer b) {
}
public void append(final char ch) {
}
public void append(final byte[] b, final int off, final int len) {
}
public void append(final ByteArrayBuffer b, final int off, final int len) {
}
public void append(final Object obj) {
}
public void clear() {
}
public char[] toCharArray() {
return null;
}
@Override
public char charAt(final int i) {
return 0;
}
public char[] buffer() {
return null;
}
public int capacity() {
return 0;
}
@Override
public int length() {
return 0;
}
public void ensureCapacity(final int required) {
}
public void setLength(final int len) {
}
public boolean isEmpty() {
return false;
}
public boolean isFull() {
return false;
}
public int indexOf(final int ch, final int from, final int to) {
return 0;
}
public int indexOf(final int ch) {
return 0;
}
public String substring(final int beginIndex, final int endIndex) {
return null;
}
public String substringTrimmed(final int beginIndex, final int endIndex) {
return null;
}
@Override
public CharSequence subSequence(final int beginIndex, final int endIndex) {
return null;
}
@Override
public String toString() {
return null;
}
}