File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .box .sdk ;
22
3+ import com .eclipsesource .json .Json ;
34import com .eclipsesource .json .JsonObject ;
45import com .eclipsesource .json .JsonValue ;
56
@@ -10,13 +11,27 @@ public class BoxNotificationEmail extends BoxJSONObject {
1011 private boolean isConfirmed ;
1112 private String email ;
1213
14+
15+ /**
16+ * Constructs a BoxNotificationEmail object.
17+ *
18+ * @param email The email address to send the notifications to.
19+ * @param isConfirmed Specifies if this email address has been confirmed.
20+ */
21+ public BoxNotificationEmail (String email , boolean isConfirmed ) {
22+ this (new JsonObject ()
23+ .add ("email" , email )
24+ .add ("is_confirmed" , isConfirmed )
25+ );
26+ }
27+
1328 /**
1429 * Constructs a BoxNotificationEmail from a JSON string.
1530 *
1631 * @param json the json encoded email alias.
1732 */
1833 public BoxNotificationEmail (String json ) {
19- super ( json );
34+ this ( Json . parse ( json ). asObject () );
2035 }
2136
2237 /**
@@ -29,7 +44,7 @@ public BoxNotificationEmail(String json) {
2944 }
3045
3146 /**
32- * Gets whether or not the email address has been confirmed.
47+ * Gets if this email address has been confirmed.
3348 *
3449 * @return true if this email address has been confirmed; otherwise false.
3550 */
Original file line number Diff line number Diff line change @@ -547,6 +547,17 @@ public void deleteAvatar() {
547547 user .deleteAvatar ();
548548 }
549549
550+ @ Test
551+ public void createBoxNotificationEmailSetsAllFields () {
552+ final String email = "mail@box.com" ;
553+ final boolean isConfirmed = true ;
554+
555+ BoxNotificationEmail boxNotificationEmail = new BoxNotificationEmail (email , isConfirmed );
556+
557+ assertEquals (email , boxNotificationEmail .getEmail ());
558+ assertEquals (isConfirmed , boxNotificationEmail .getIsConfirmed ());
559+ }
560+
550561 private static String getSampleFilePath (String fileName ) {
551562 URL fileURL = BoxUserTest .class .getResource ("/sample-files/" + fileName );
552563 try {
You can’t perform that action at this time.
0 commit comments