1616
1717package org .cloudfoundry .client .v3 ;
1818
19+ import static org .assertj .core .api .Assertions .assertThat ;
20+
21+ import java .time .Duration ;
1922import org .cloudfoundry .AbstractIntegrationTest ;
2023import org .cloudfoundry .CloudFoundryVersion ;
2124import org .cloudfoundry .IfCloudFoundryVersion ;
2730import reactor .core .publisher .Mono ;
2831import reactor .test .StepVerifier ;
2932
30- import java .time .Duration ;
31-
32- import static org .assertj .core .api .Assertions .assertThat ;
33-
3433@ IfCloudFoundryVersion (greaterThanOrEqualTo = CloudFoundryVersion .PCF_4_v3 )
3534public final class UsersTest extends AbstractIntegrationTest {
3635
37- @ Autowired
38- private CloudFoundryClient cloudFoundryClient ;
36+ @ Autowired private CloudFoundryClient cloudFoundryClient ;
3937
4038 @ Test
4139 public void create () {
4240 String userId = this .nameFactory .getUserId ();
4341
4442 this .cloudFoundryClient
4543 .usersV3 ()
46- .create (CreateUserRequest .builder ()
47- .userId (userId )
48- .build ()
49- )
44+ .create (CreateUserRequest .builder ().userId (userId ).build ())
5045 .single ()
5146 .as (StepVerifier ::create )
5247 .expectNextCount (1 )
@@ -59,11 +54,11 @@ public void get() {
5954 String userId = this .nameFactory .getUserId ();
6055
6156 createUser (this .cloudFoundryClient , userId )
62- .flatMap (createUserResponse ->
63- this . cloudFoundryClient . usersV3 ()
64- . get ( GetUserRequest . builder ()
65- .userId ( userId )
66- .build ()))
57+ .flatMap (
58+ createUserResponse ->
59+ this . cloudFoundryClient
60+ .usersV3 ( )
61+ .get ( GetUserRequest . builder (). userId ( userId ). build ()))
6762 .map (GetUserResponse ::getId )
6863 .as (StepVerifier ::create )
6964 .expectNext (userId )
@@ -97,19 +92,23 @@ public void update() {
9792 String userId = this .nameFactory .getUserId ();
9893
9994 createUser (this .cloudFoundryClient , userId )
100- .flatMap (createUserResponse ->
101- this .cloudFoundryClient .usersV3 ()
102- .update (UpdateUserRequest .builder ()
103- .userId (userId )
104- .metadata (Metadata .builder ()
105- .annotation (
106- "annotationKey" ,
107- "annotationValue" )
108- .label (
109- "labelKey" ,
110- "labelValue" )
111- .build ())
112- .build ()))
95+ .flatMap (
96+ createUserResponse ->
97+ this .cloudFoundryClient
98+ .usersV3 ()
99+ .update (
100+ UpdateUserRequest .builder ()
101+ .userId (userId )
102+ .metadata (
103+ Metadata .builder ()
104+ .annotation (
105+ "annotationKey" ,
106+ "annotationValue" )
107+ .label (
108+ "labelKey" ,
109+ "labelValue" )
110+ .build ())
111+ .build ()))
113112 .then (getUser (cloudFoundryClient , userId ))
114113 .as (StepVerifier ::create )
115114 .consumeNextWith (
@@ -122,7 +121,6 @@ public void update() {
122121 })
123122 .expectComplete ()
124123 .verify (Duration .ofMinutes (5 ));
125-
126124 }
127125
128126 @ Test
@@ -152,8 +150,6 @@ private static Mono<CreateUserResponse> createUser(
152150
153151 private static Mono <GetUserResponse > getUser (
154152 CloudFoundryClient cloudFoundryClient , String userId ) {
155- return cloudFoundryClient
156- .usersV3 ()
157- .get (GetUserRequest .builder ().userId (userId ).build ());
153+ return cloudFoundryClient .usersV3 ().get (GetUserRequest .builder ().userId (userId ).build ());
158154 }
159- }
155+ }
0 commit comments