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

box / box-java-sdk / #6779

29 Apr 2026 03:28PM UTC coverage: 12.64% (-0.02%) from 12.66%
#6779

push

github

web-flow
fix(boxsdkgen): Fix java `oneOf` serialization (box/box-codegen#942) (#1805)

0 of 105 new or added lines in 13 files covered. (0.0%)

18 existing lines in 13 files now uncovered.

8374 of 66251 relevant lines covered (12.64%)

0.13 hits per line

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

0.0
/src/main/java/com/box/sdkgen/internal/OneOfThree.java
1
package com.box.sdkgen.internal;
2

3
import com.box.sdkgen.serialization.json.JsonManager;
4
import com.fasterxml.jackson.core.JsonGenerator;
5
import com.fasterxml.jackson.databind.JsonSerializer;
6
import com.fasterxml.jackson.databind.ObjectMapper;
7
import com.fasterxml.jackson.databind.SerializerProvider;
8
import java.io.IOException;
9

10
public class OneOfThree<T0, T1, T2> extends SerializableObject implements OneOfUnion {
11
  protected static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
×
12
  protected T0 value0;
13
  protected T1 value1;
14
  protected T2 value2;
15

16
  public OneOfThree(T0 value0, T1 value1, T2 value2) {
×
17
    this.value0 = value0;
×
18
    this.value1 = value1;
×
19
    this.value2 = value2;
×
20
  }
×
21

22
  @Override
23
  public boolean hasAnyNonNullValue() {
NEW
24
    return value0 != null || value1 != null || value2 != null;
×
25
  }
26

27
  public static class OneOfThreeSerializer extends JsonSerializer<OneOfThree<?, ?, ?>> {
28

29
    public OneOfThreeSerializer() {
30
      super();
×
31
    }
×
32

33
    @Override
34
    public void serialize(
35
        OneOfThree<?, ?, ?> itemEntryField, JsonGenerator gen, SerializerProvider provider)
36
        throws IOException {
37
      if (itemEntryField.value0 != null) {
×
38
        JsonManager.WRITER.writeValue(gen, itemEntryField.value0);
×
NEW
39
        return;
×
40
      }
41
      if (itemEntryField.value1 != null) {
×
42
        JsonManager.WRITER.writeValue(gen, itemEntryField.value1);
×
NEW
43
        return;
×
44
      }
45
      if (itemEntryField.value2 != null) {
×
46
        JsonManager.WRITER.writeValue(gen, itemEntryField.value2);
×
NEW
47
        return;
×
48
      }
NEW
49
      gen.writeNull();
×
UNCOV
50
    }
×
51
  }
52
}
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

© 2026 Coveralls, Inc