incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1164046 - /incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java
Date Thu, 01 Sep 2011 12:31:56 GMT
Author: danhaywood
Date: Thu Sep  1 12:31:56 2011
New Revision: 1164046

URL: http://svn.apache.org/viewvc?rev=1164046&view=rev
Log:
ISIS-109: reworking home page, also services list and user

Added:
    incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java

Added: incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java?rev=1164046&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java
(added)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_putXxx.java
Thu Sep  1 12:31:56 2011
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.apache.isis.viewer.json.applib;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JsonRepresentationTest_putXxx {
+
+
+    private JsonRepresentation jsonRepresentation;
+
+    @Before
+    public void setUp() throws Exception {
+        jsonRepresentation = JsonRepresentation.newMap();
+    }
+    
+    @Test
+    public void putInt() throws JsonParseException, JsonMappingException, IOException {
+        jsonRepresentation.put("a", 123);
+        assertThat(jsonRepresentation.getInt("a"), is(123));
+    }
+
+    @Test
+    public void putInt_multipart() throws JsonParseException, JsonMappingException, IOException
{
+        jsonRepresentation.put("a.b", 456);
+        assertThat(jsonRepresentation.getInt("a.b"), is(456));
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void putInt_pathBlockedByValue() throws JsonParseException, JsonMappingException,
IOException {
+        //given
+        jsonRepresentation.put("a", 123);
+
+        // when
+        jsonRepresentation.put("a.b", 456);
+    }
+
+    
+}



Mime
View raw message