void outputContextMap()

in src/main/java/org/apache/sling/junit/impl/servlet/JsonRenderer.java [173:200]


    void outputContextMap(Map<String, Object> data) throws JsonException {
        writer.writeStartObject(TEST_METADATA);
        try {
            for(Map.Entry<String, Object> e : data.entrySet()) {
                Object value = e.getValue();
                if (value instanceof Long) {
                    writer.write(e.getKey(), (Long)e.getValue());
                }
                else if (value instanceof Integer) {
                    writer.write(e.getKey(), (Integer)e.getValue());
                }
                else if (value instanceof Double) {
                    writer.write(e.getKey(), (Double)e.getValue());
                }
                else if (value instanceof Boolean) {
                    writer.write(e.getKey(), (Boolean)e.getValue());
                }
                else if (value instanceof String) {
                    writer.write(e.getKey(), (String)e.getValue());
                }
                else {
                    throw new IllegalArgumentException("Unexpected value for JSON: " + value);
                }
            }
        } finally {
            writer.writeEnd();
        }
    }