Skip to content

Commit e721c31

Browse files
tanya732adenix
andauthored
Feat: add constructor to set clientId on Client creation (#781)
Co-authored-by: Austin Nicholas <anicholas@netflix.com>
1 parent cda78f9 commit e721c31

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/main/java/com/auth0/json/mgmt/client/Client.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ public Client(@JsonProperty("name") String name) {
154154
this.name = name;
155155
}
156156

157+
/**
158+
* Creates a new Application instance setting the name and client id properties.
159+
*
160+
* @param name of the application.
161+
* @param clientId the client id of the application.
162+
*/
163+
public Client(String name, String clientId) {
164+
this.name = name;
165+
this.clientId = clientId;
166+
}
167+
157168
/**
158169
* Getter for the name of the application.
159170
*

src/test/java/com/auth0/json/mgmt/client/ClientTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,18 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception {
377377
assertThat(client.isHerokuApp(), is(true));
378378
assertThat(client.getSigningKeys(), is(notNullValue()));
379379
}
380+
381+
@Test
382+
public void shouldCreateClientWithNameOnly() {
383+
Client client = new Client("My App");
384+
assertThat(client.getName(), is("My App"));
385+
assertThat(client.getClientId(), is(nullValue()));
386+
}
387+
388+
@Test
389+
public void shouldCreateClientWithNameAndClientId() {
390+
Client client = new Client("My App", "client123");
391+
assertThat(client.getName(), is("My App"));
392+
assertThat(client.getClientId(), is("client123"));
393+
}
380394
}

0 commit comments

Comments
 (0)