### Question:
OrientationOptions { public static OrientationOptions parse(JSONObject json) { OrientationOptions options = new OrientationOptions(); if (json == null) return options; JSONArray orientations = json.optJSONArray("orientation"); if (orientations == null) { String orientation = json.optString("orientation", Orientation.Default.name); options.orientations.add(Orientation.fromString(orientation)); } else { List<Orientation> parsed = new ArrayList<>(); for (int i = 0; i < orientations.length(); i++) { Orientation o = Orientation.fromString(orientations.optString(i, "default")); if (o != null) { parsed.add(o); } } options.orientations = parsed; } return options; }  static OrientationOptions parse(JSONObject json); int getValue(); boolean hasValue(); @CheckResult OrientationOptions copy(); OrientationOptions mergeWithDefault(OrientationOptions defaultOptions); @Override String toString();  }### Answer:
@Test public void parse() { OrientationOptions options = OrientationOptions.parse(create("default")); assertThat(options.orientations).hasSize(1); }
@Test public void parseOrientations() { OrientationOptions options = OrientationOptions.parse(create("default", "landscape", "portrait")); assertThat(options.orientations.get(0)).isEqualTo(Orientation.Default); assertThat(options.orientations.get(1)).isEqualTo(Orientation.Landscape); assertThat(options.orientations.get(2)).isEqualTo(Orientation.Portrait); }
@Test public void parseSingleOrientation() { OrientationOptions options = OrientationOptions.parse(create("landscape")); assertThat(options.orientations.get(0)).isEqualTo(Orientation.Landscape); }
@Test public void unsupportedOrientationsAreIgnored() { OrientationOptions options = OrientationOptions.parse(create("default", "autoRotate")); assertThat(options.orientations).hasSize(1); assertThat(options.orientations.get(0)).isEqualTo(Orientation.Default); }