Java tutorial
/* * Copyright 2014 IMS Global Learning Consortium. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.imsglobal.lti.lti2; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import org.imsglobal.lti2.objects.consumer.ToolConsumer; import org.junit.Test; import java.io.IOException; /** * * @author pgray */ public class ToolConsumerTest { @Test public void TestProfile() throws IOException { TestLtiConsumerProfile config = new TestLtiConsumerProfile(); ToolConsumer consumer = new ToolConsumer("guid", "LTI-2p0", "tcp?", config); //consumer.addCapabilites(config.getCapabilities()); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); String json = mapper.writeValueAsString(consumer); System.out.println(json); ToolConsumer parsed = mapper.readValue(json, ToolConsumer.class); } }