Skip to content

Commit fd08a03

Browse files
committed
Add @deprecated anotation, re-add tests using deprecated setters
1 parent 8c1cbe3 commit fd08a03

5 files changed

Lines changed: 64 additions & 3 deletions

File tree

src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public EnrollmentTicket(String userId, Boolean sendEmail, String email) {
6868
* Getter for the id of the User this ticket was made for.
6969
*
7070
* @return the user id.
71-
* @deprecated
7271
*/
7372
@JsonProperty("user_id")
7473
public String getUserId() {
@@ -81,6 +80,7 @@ public String getUserId() {
8180
* @param userId the user id to set.
8281
* @deprecated use the constructor instead
8382
*/
83+
@Deprecated
8484
@JsonProperty("user_id")
8585
public void setUserId(String userId) {
8686
this.userId = userId;
@@ -90,7 +90,6 @@ public void setUserId(String userId) {
9090
* Whether to send and email for enrollment or not.
9191
*
9292
* @return true is this ticket will send an email upon enrollment, false otherwise.
93-
* @deprecated
9493
*/
9594
@JsonProperty("send_mail")
9695
public Boolean willSendEmail() {
@@ -103,6 +102,7 @@ public Boolean willSendEmail() {
103102
* @param sendEmail whether this ticket will send an email upon enrollment or not.
104103
* @deprecated use the constructor instead
105104
*/
105+
@Deprecated
106106
@JsonProperty("send_mail")
107107
public void setSendEmail(Boolean sendEmail) {
108108
this.sendEmail = sendEmail;
@@ -112,7 +112,6 @@ public void setSendEmail(Boolean sendEmail) {
112112
* Getter for the email to which the ticket will be sent.
113113
*
114114
* @return the email.
115-
* @deprecated
116115
*/
117116
@JsonProperty("email")
118117
public String getEmail() {
@@ -125,6 +124,7 @@ public String getEmail() {
125124
* @param email the email to sent the ticket to.
126125
* @deprecated use the constructor instead
127126
*/
127+
@Deprecated
128128
@JsonProperty("email")
129129
public void setEmail(String email) {
130130
this.email = email;

src/main/java/com/auth0/json/mgmt/guardian/SNSFactorProvider.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ public class SNSFactorProvider {
2525
@JsonProperty("sns_gcm_platform_application_arn")
2626
private String snsGCMPlatformApplicationArn;
2727

28+
/**
29+
* Creates an empty SNS settings object
30+
*
31+
* @deprecated use the full constructor instead
32+
*/
33+
@Deprecated
34+
public SNSFactorProvider() {
35+
}
36+
2837
/**
2938
* Creates a SNS settings object
3039
*
@@ -59,6 +68,7 @@ public String getAWSAccessKeyId() {
5968
* @param awsAccessKeyId the AWS access key id to set.
6069
* @deprecated use the constructor instead
6170
*/
71+
@Deprecated
6272
@JsonProperty("aws_access_key_id")
6373
public void setAWSAccessKeyId(String awsAccessKeyId) {
6474
this.awsAccessKeyId = awsAccessKeyId;
@@ -80,6 +90,7 @@ public String getAWSSecretAccessKey() {
8090
* @param awsSecretAccessKey the AWS secret access key to set.
8191
* @deprecated use the constructor instead
8292
*/
93+
@Deprecated
8394
@JsonProperty("aws_secret_access_key")
8495
public void setAWSSecretAccessKey(String awsSecretAccessKey) {
8596
this.awsSecretAccessKey = awsSecretAccessKey;
@@ -101,6 +112,7 @@ public String getAWSRegion() {
101112
* @param awsRegion the AWS region to set.
102113
* @deprecated use the constructor instead
103114
*/
115+
@Deprecated
104116
@JsonProperty("aws_region")
105117
public void setAWSRegion(String awsRegion) {
106118
this.awsRegion = awsRegion;
@@ -122,6 +134,7 @@ public String getSNSAPNSPlatformApplicationARN() {
122134
* @param apnARN the SNS APNs ARN to set.
123135
* @deprecated use the constructor instead
124136
*/
137+
@Deprecated
125138
@JsonProperty("sns_apns_platform_application_arn")
126139
public void setSNSAPNSPlatformApplicationARN(String apnARN) {
127140
this.snsAPNSPlatformApplicationArn = apnARN;
@@ -143,6 +156,7 @@ public String getSNSGCMPlatformApplicationARN() {
143156
* @param gcmARN the SNS GCM ARN to set.
144157
* @deprecated use the constructor instead
145158
*/
159+
@Deprecated
146160
@JsonProperty("sns_gcm_platform_application_arn")
147161
public void setSNSGCMPlatformApplicationARN(String gcmARN) {
148162
this.snsGCMPlatformApplicationArn = gcmARN;

src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public class TwilioFactorProvider {
2323
@JsonProperty("sid")
2424
private String sid;
2525

26+
/**
27+
* Creates an empty Twilio settings object
28+
*
29+
* @deprecated use the full constructor instead
30+
*/
31+
@Deprecated
32+
public TwilioFactorProvider() {
33+
}
34+
2635
/**
2736
* Creates a Twilio settings object
2837
*
@@ -55,6 +64,7 @@ public String getFrom() {
5564
* @param from the from number to set.
5665
* @deprecated use the constructor instead
5766
*/
67+
@Deprecated
5868
@JsonProperty("from")
5969
public void setFrom(String from) {
6070
this.from = from;
@@ -76,6 +86,7 @@ public String getMessagingServiceSID() {
7686
* @param messagingServiceSID the messaging service SID.
7787
* @deprecated use the constructor instead
7888
*/
89+
@Deprecated
7990
@JsonProperty("messaging_service_sid")
8091
public void setMessagingServiceSID(String messagingServiceSID) {
8192
this.messagingServiceSID = messagingServiceSID;
@@ -97,6 +108,7 @@ public String getAuthToken() {
97108
* @param authToken the Twilio auth token to set.
98109
* @deprecated use the constructor instead
99110
*/
111+
@Deprecated
100112
@JsonProperty("auth_token")
101113
public void setAuthToken(String authToken) {
102114
this.authToken = authToken;
@@ -118,6 +130,7 @@ public String getSID() {
118130
* @param SID the Twilio SID to set.
119131
* @deprecated use the constructor instead
120132
*/
133+
@Deprecated
121134
@JsonProperty("sid")
122135
public void setSID(String SID) {
123136
this.sid = SID;

src/test/java/com/auth0/json/mgmt/guardian/SNSFactorProviderTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ public class SNSFactorProviderTest extends JsonTest<SNSFactorProvider> {
1212

1313
private static final String json = "{\"aws_access_key_id\":\"akey\",\"aws_secret_access_key\":\"secretakey\",\"aws_region\":\"ar\",\"sns_apns_platform_application_arn\":\"arn1\",\"sns_gcm_platform_application_arn\":\"arn2\"}";
1414

15+
@Test
16+
public void shouldSerializeWithDeprecatedSetters() throws Exception {
17+
SNSFactorProvider provider = new SNSFactorProvider();
18+
provider.setAWSRegion("ar");
19+
provider.setAWSAccessKeyId("akey");
20+
provider.setAWSSecretAccessKey("secretakey");
21+
provider.setSNSAPNSPlatformApplicationARN("arn1");
22+
provider.setSNSGCMPlatformApplicationARN("arn2");
23+
24+
String serialized = toJSON(provider);
25+
assertThat(serialized, is(notNullValue()));
26+
assertThat(serialized, JsonMatcher.hasEntry("aws_access_key_id", "akey"));
27+
assertThat(serialized, JsonMatcher.hasEntry("aws_secret_access_key", "secretakey"));
28+
assertThat(serialized, JsonMatcher.hasEntry("aws_region", "ar"));
29+
assertThat(serialized, JsonMatcher.hasEntry("sns_apns_platform_application_arn", "arn1"));
30+
assertThat(serialized, JsonMatcher.hasEntry("sns_gcm_platform_application_arn", "arn2"));
31+
}
32+
1533
@Test
1634
public void shouldSerialize() throws Exception {
1735
SNSFactorProvider provider = new SNSFactorProvider("akey", "secretakey", "ar", "arn1", "arn2");

src/test/java/com/auth0/json/mgmt/guardian/TwilioFactorProviderTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ public class TwilioFactorProviderTest extends JsonTest<TwilioFactorProvider> {
1212

1313
private static final String json = "{\"from\":\"+12356789\",\"messaging_service_sid\":\"id321\",\"auth_token\":\"atokEn\",\"sid\":\"id123\"}";
1414

15+
@Test
16+
public void shouldSerializeWithDeprecatedSetters() throws Exception {
17+
TwilioFactorProvider provider = new TwilioFactorProvider();
18+
provider.setAuthToken("atokEn");
19+
provider.setFrom("+12356789");
20+
provider.setMessagingServiceSID("id321");
21+
provider.setSID("id123");
22+
23+
String serialized = toJSON(provider);
24+
assertThat(serialized, is(notNullValue()));
25+
assertThat(serialized, JsonMatcher.hasEntry("from", "+12356789"));
26+
assertThat(serialized, JsonMatcher.hasEntry("messaging_service_sid", "id321"));
27+
assertThat(serialized, JsonMatcher.hasEntry("auth_token", "atokEn"));
28+
assertThat(serialized, JsonMatcher.hasEntry("sid", "id123"));
29+
}
30+
1531
@Test
1632
public void shouldSerialize() throws Exception {
1733
TwilioFactorProvider provider = new TwilioFactorProvider("+12356789", "id321", "atokEn", "id123");

0 commit comments

Comments
 (0)