### Question:
PrimitiveUpdateExpression extends PartialUpdateExpression { public static PrimitiveUpdateExpression fromJson(ObjectNode node) { if (node.has(UpdateOperator._add.toString()) || node.has(UpdateOperator._set.toString())) { return SetExpression.fromJson(node); } else if (node.has(UpdateOperator._unset.toString())) { return UnsetExpression.fromJson(node); } else { throw Error.get(QueryConstants.ERR_INVALID_UPDATE_EXPRESSION, node.toString()); } }  static PrimitiveUpdateExpression fromJson(ObjectNode node);  }### Answer:
@Test public void testFromJson() throws IOException { List<FieldAndRValue> list = new ArrayList<>(); FieldAndRValue fav = new FieldAndRValue(); fav.setField(Path.EMPTY); fav.setRValue(new RValueExpression(Path.EMPTY)); list.add(fav); PrimitiveUpdateExpression expResult = new SetExpression(UpdateOperator._set, list); PrimitiveUpdateExpression result = PrimitiveUpdateExpression.fromJson((ObjectNode) JsonUtils.json("{\"$set\":{\"\":{\"$valueof\":\"\"}}}")); assertEquals(expResult, result); expResult = new SetExpression(UpdateOperator._add, list); result = PrimitiveUpdateExpression.fromJson((ObjectNode) JsonUtils.json("{\"$add\":{\"\":{\"$valueof\":\"\"}}}")); assertEquals(expResult, result); expResult = new UnsetExpression(Arrays.asList(Path.EMPTY)); result = PrimitiveUpdateExpression.fromJson((ObjectNode) JsonUtils.json("{\"$unset\":[\"\"]}")); assertEquals(expResult, result); boolean error = false; try { result = PrimitiveUpdateExpression.fromJson((ObjectNode) JsonUtils.json("{\"$append\":{\"\":{\"$valueof\":\"\"}}}")); fail(); } catch (Error e) { error = true; String expError = Error.get( QueryConstants.ERR_INVALID_UPDATE_EXPRESSION, JsonUtils.json("{\"$append\":{\"\":{\"$valueof\":\"\"}}}").toString()) .toString(); assertEquals(expError, e.toString()); } assertTrue("Execption expected!", error); }