Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/feign/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface Client {
*/
Response execute(Request request, Options options) throws IOException;

public static class Default implements Client {
class Default implements Client {

private final SSLSocketFactory sslContextFactory;
private final HostnameVerifier hostnameVerifier;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/feign/Retryer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface Retryer extends Cloneable {

Retryer clone();

public static class Default implements Retryer {
class Default implements Retryer {

private final int maxAttempts;
private final long period;
Expand Down
61 changes: 61 additions & 0 deletions core/src/test/java/feign/template/HeaderTemplateTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright 2012-2019 The Feign Authors
*
* Licensed 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.
*/
package feign.template;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.Assert.assertEquals;

public class HeaderTemplateTest {

@Rule
public ExpectedException exception = ExpectedException.none();

@Test(expected = IllegalArgumentException.class)
public void it_should_throw_exception_when_name_is_null() {
HeaderTemplate.create(null, Arrays.asList("test"));
exception.expectMessage("name is required.");
}

@Test(expected = IllegalArgumentException.class)
public void it_should_throw_exception_when_name_is_empty() {
HeaderTemplate.create("", Arrays.asList("test"));
exception.expectMessage("name is required.");
}

@Test(expected = IllegalArgumentException.class)
public void it_should_throw_exception_when_value_is_null() {
HeaderTemplate.create("test", null);
exception.expectMessage("values are required");
}

@Test
public void it_should_return_name() {
HeaderTemplate headerTemplate =
HeaderTemplate.create("test", Arrays.asList("test 1", "test 2"));
assertEquals("test", headerTemplate.getName());
}

@Test
public void it_should_return_expanded() {
HeaderTemplate headerTemplate = HeaderTemplate.create("hello", Arrays.asList("emre", "savci"));
assertEquals("hello emre, savci", headerTemplate.expand(Collections.emptyMap()));
assertEquals("hello emre, savci",
headerTemplate.expand(Collections.singletonMap("name", "firsts")));
}

}