• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #3909

12 Jul 2024 01:30PM CUT coverage: 72.476% (+0.04%) from 72.438%
#3909

Pull #1258

github

web-flow
Merge 6eb7aa968 into f08844889
Pull Request #1258: test: Add test for uploading file using stream

7681 of 10598 relevant lines covered (72.48%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/box/sdk/BoxUploadEmail.java
1
package com.box.sdk;
2

3
import com.eclipsesource.json.JsonObject;
4
import com.eclipsesource.json.JsonValue;
5

6
/**
7
 * Represents an email address that can be used to upload files to a folder on Box.
8
 */
9
public class BoxUploadEmail extends BoxJSONObject {
10
    private Access access;
11
    private String email;
12

13
    /**
14
     * Constructs a BoxUploadEmail with default settings.
15
     */
16
    public BoxUploadEmail() {
×
17
    }
×
18

19
    /**
20
     * Constructs a BoxUploadEmail from a JSON string.
21
     *
22
     * @param json the JSON encoded upload email.
23
     */
24
    public BoxUploadEmail(String json) {
25
        super(json);
×
26
    }
×
27

28
    BoxUploadEmail(JsonObject jsonObject) {
29
        super(jsonObject);
×
30
    }
×
31

32
    /**
33
     * Gets the access level of this upload email.
34
     *
35
     * @return the access level of this upload email.
36
     */
37
    public Access getAccess() {
38
        return this.access;
×
39
    }
40

41
    /**
42
     * Sets the access level of this upload email.
43
     *
44
     * @param access the new access level of this upload email.
45
     */
46
    public void setAccess(Access access) {
47
        this.access = access;
×
48
        this.addPendingChange("access", access.toJSONValue());
×
49
    }
×
50

51
    /**
52
     * Gets the email address of this upload email.
53
     *
54
     * @return the email address of this upload email.
55
     */
56
    public String getEmail() {
57
        return this.email;
×
58
    }
59

60
    @Override
61
    void parseJSONMember(JsonObject.Member member) {
62
        JsonValue value = member.getValue();
×
63
        String memberName = member.getName();
×
64
        try {
65
            if (memberName.equals("access")) {
×
66
                this.access = Access.fromJSONValue(value.asString());
×
67
            } else if (memberName.equals("email")) {
×
68
                this.email = value.asString();
×
69
            }
70
        } catch (Exception e) {
×
71
            throw new BoxDeserializationException(memberName, value.toString(), e);
×
72
        }
×
73
    }
×
74

75
    /**
76
     * Enumerates the possible access levels that can be set on an upload email.
77
     */
78
    public enum Access {
×
79
        /**
80
         * Anyone can send an upload to this email address.
81
         */
82
        OPEN("open"),
×
83

84
        /**
85
         * Only collaborators can send an upload to this email address.
86
         */
87
        COLLABORATORS("collaborators");
×
88

89
        private final String jsonValue;
90

91
        Access(String jsonValue) {
×
92
            this.jsonValue = jsonValue;
×
93
        }
×
94

95
        static Access fromJSONValue(String jsonValue) {
96
            return Access.valueOf(jsonValue.toUpperCase());
×
97
        }
98

99
        String toJSONValue() {
100
            return this.jsonValue;
×
101
        }
102
    }
103
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc