@Test public void should_throwIllegalArgumentException_when_JsonNullUnit() { ObjectNode unitJson = null; assertThatThrownBy(() -> { MetadataDocumentHelper.getStrategyIdFromUnit(unitJson); }).isInstanceOf(IllegalArgumentException.class); }
public static String getStrategyIdFromUnit(JsonNode unitJson) { if (unitJson == null || !unitJson.isObject()) { throw new IllegalArgumentException("Expected unit object json"); } ObjectNode unit = (ObjectNode) unitJson; if (!unit.has(VitamFieldsHelper.storage()) || !unit.get(VitamFieldsHelper.storage()).has(STRATEGY_KEY) || !unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).isTextual()) { throw new IllegalArgumentException("Expected storage/strategy information in unit"); } return unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).asText(); }
MetadataDocumentHelper { public static String getStrategyIdFromUnit(JsonNode unitJson) { if (unitJson == null || !unitJson.isObject()) { throw new IllegalArgumentException("Expected unit object json"); } ObjectNode unit = (ObjectNode) unitJson; if (!unit.has(VitamFieldsHelper.storage()) || !unit.get(VitamFieldsHelper.storage()).has(STRATEGY_KEY) || !unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).isTextual()) { throw new IllegalArgumentException("Expected storage/strategy information in unit"); } return unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).asText(); } }
MetadataDocumentHelper { public static String getStrategyIdFromUnit(JsonNode unitJson) { if (unitJson == null || !unitJson.isObject()) { throw new IllegalArgumentException("Expected unit object json"); } ObjectNode unit = (ObjectNode) unitJson; if (!unit.has(VitamFieldsHelper.storage()) || !unit.get(VitamFieldsHelper.storage()).has(STRATEGY_KEY) || !unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).isTextual()) { throw new IllegalArgumentException("Expected storage/strategy information in unit"); } return unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).asText(); }  }
MetadataDocumentHelper { public static String getStrategyIdFromUnit(JsonNode unitJson) { if (unitJson == null || !unitJson.isObject()) { throw new IllegalArgumentException("Expected unit object json"); } ObjectNode unit = (ObjectNode) unitJson; if (!unit.has(VitamFieldsHelper.storage()) || !unit.get(VitamFieldsHelper.storage()).has(STRATEGY_KEY) || !unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).isTextual()) { throw new IllegalArgumentException("Expected storage/strategy information in unit"); } return unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).asText(); }  static List<String> getComputedGraphUnitFields(); static List<String> getComputedGraphObjectGroupFields(); static Set<String> getTemporaryUnitFields(); static Set<String> getComputedUnitFields(); static Set<String> getComputedObjectGroupFields(); static void removeComputedFieldsFromUnit(JsonNode unitJson); static void removeComputedFieldsFromObjectGroup(JsonNode objectGroupJson); static String getStrategyIdFromRawUnitOrGot(JsonNode documentJson); static String getStrategyIdFromUnit(JsonNode unitJson); }
MetadataDocumentHelper { public static String getStrategyIdFromUnit(JsonNode unitJson) { if (unitJson == null || !unitJson.isObject()) { throw new IllegalArgumentException("Expected unit object json"); } ObjectNode unit = (ObjectNode) unitJson; if (!unit.has(VitamFieldsHelper.storage()) || !unit.get(VitamFieldsHelper.storage()).has(STRATEGY_KEY) || !unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).isTextual()) { throw new IllegalArgumentException("Expected storage/strategy information in unit"); } return unit.get(VitamFieldsHelper.storage()).get(STRATEGY_KEY).asText(); }  static List<String> getComputedGraphUnitFields(); static List<String> getComputedGraphObjectGroupFields(); static Set<String> getTemporaryUnitFields(); static Set<String> getComputedUnitFields(); static Set<String> getComputedObjectGroupFields(); static void removeComputedFieldsFromUnit(JsonNode unitJson); static void removeComputedFieldsFromObjectGroup(JsonNode objectGroupJson); static String getStrategyIdFromRawUnitOrGot(JsonNode documentJson); static String getStrategyIdFromUnit(JsonNode unitJson);  }