Skip to content

Commit d7be204

Browse files
therepanicdsyer
authored andcommitted
Add test for default target resolution in DefaultGrpcChannelFactoryTests
Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
1 parent 17256b3 commit d7be204

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2023-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.grpc.client;
18+
19+
import static org.assertj.core.api.Assertions.assertThat;
20+
import static org.mockito.Mockito.mock;
21+
22+
import java.util.List;
23+
24+
import org.junit.jupiter.api.Test;
25+
26+
/**
27+
* Tests for {@link DefaultGrpcChannelFactory}.
28+
*
29+
* @author Andrey Litvitski
30+
*/
31+
class DefaultGrpcChannelFactoryTests {
32+
33+
@Test
34+
void defaultTargetResolvesToLocalhost() {
35+
var factory = new DefaultGrpcChannelFactory<>(List.of(), mock());
36+
assertThat(factory.targets).isSameAs(VirtualTargets.DEFAULT);
37+
assertThat(factory.targets.getTarget("default")).isEqualTo("localhost:9090");
38+
}
39+
40+
}

0 commit comments

Comments
 (0)