Skip to content

Commit 2d46493

Browse files
committed
Merge branch '3.5.x' of github.com:freefair/okhttp-spring-boot into 4.0.x
2 parents 74e85d4 + ce19cb7 commit 2d46493

File tree

7 files changed

+84
-0
lines changed

7 files changed

+84
-0
lines changed

starters/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ subprojects { Project starterProject ->
66
attributes 'Spring-Boot-Jar-Type': 'dependencies-starter'
77
}
88
}
9+
10+
test.useJUnitPlatform()
911
}

starters/okhttp4-spring-boot-starter/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ dependencies {
1010
api project(':okhttp-spring-boot-autoconfigure')
1111
api project(':okhttp-spring-client')
1212
api 'com.squareup.okhttp3:okhttp'
13+
14+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
1315
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package io.freefair.okhttp.starter4;
2+
3+
import okhttp3.OkHttpClient;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
8+
import org.springframework.context.ConfigurableApplicationContext;
9+
10+
import static org.assertj.core.api.Assertions.assertThat;
11+
12+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
13+
public class OkHttp4Test {
14+
15+
@Autowired
16+
private ConfigurableApplicationContext applicationContext;
17+
18+
@Test
19+
void contextLoads() {
20+
assertThat(applicationContext).isNotNull();
21+
}
22+
23+
@Test
24+
void hasClientBean() {
25+
AssertableApplicationContext context = AssertableApplicationContext.get(() -> applicationContext);
26+
27+
assertThat(context).hasSingleBean(OkHttpClient.class);
28+
OkHttpClient okHttpClient = context.getBean(OkHttpClient.class);
29+
30+
assertThat(okHttpClient).isNotNull();
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.freefair.okhttp.starter4;
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
5+
@SpringBootApplication
6+
public class OkHttp4TestApplication {
7+
}

starters/okhttp5-spring-boot-starter/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ dependencies {
1111
api project(':okhttp-spring-boot-autoconfigure')
1212
api project(':okhttp-spring-client')
1313
api 'com.squareup.okhttp3:okhttp'
14+
15+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
1416
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package io.freefair.okhttp.starter5;
2+
3+
import okhttp3.OkHttpClient;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
8+
import org.springframework.context.ConfigurableApplicationContext;
9+
10+
import static org.assertj.core.api.Assertions.assertThat;
11+
12+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
13+
public class OkHttp5Test {
14+
15+
@Autowired
16+
private ConfigurableApplicationContext applicationContext;
17+
18+
@Test
19+
void contextLoads() {
20+
assertThat(applicationContext).isNotNull();
21+
}
22+
23+
@Test
24+
void hasClientBean() {
25+
AssertableApplicationContext context = AssertableApplicationContext.get(() -> applicationContext);
26+
27+
assertThat(context).hasSingleBean(OkHttpClient.class);
28+
OkHttpClient okHttpClient = context.getBean(OkHttpClient.class);
29+
30+
assertThat(okHttpClient).isNotNull();
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.freefair.okhttp.starter5;
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
5+
@SpringBootApplication
6+
public class OkHttp5TestApplication {
7+
}

0 commit comments

Comments
 (0)