package org.json.junit;

import java.util.*;

import static org.junit.Assert.*;

import org.json.*;
import org.junit.Test;


/**
 * Tests for JSON-Java Property.java
 */
public class PropertyTest {

    @Test
    public void shouldHandleNullProperties() {

        Properties properties = null;
        JSONObject jsonObject = Property.toJSONObject(properties);
        assertTrue("jsonObject should be empty", jsonObject.length() == 0);
    }

    @Test
    public void shouldHandleEmptyProperties() {

        Properties properties = new Properties();
        JSONObject jsonObject = Property.toJSONObject(properties);
        assertTrue("jsonObject should be empty", jsonObject.length() == 0);
    }

    @Test
    public void shouldHandleProperties() {
        Properties properties = new Properties();
        
        properties.put("Illinois", "Springfield");
        properties.put("Missouri", "Jefferson City");
        properties.put("Washington", "Olympia");
        properties.put("California", "Sacramento");
        properties.put("Indiana", "Indianapolis");

        JSONObject jsonObject = Property.toJSONObject(properties);

        assertTrue("jsonObject should contain 5 items", jsonObject.length() == 5);
        assertTrue("jsonObject should contain Illinois property", 
                "Springfield".equals(jsonObject.get("Illinois")));
        assertTrue("jsonObject should contain Missouri property", 
                "Jefferson City".equals(jsonObject.get("Missouri")));
        assertTrue("jsonObject should contain Washington property", 
                "Olympia".equals(jsonObject.get("Washington")));
        assertTrue("jsonObject should contain California property", 
                "Sacramento".equals(jsonObject.get("California")));
        assertTrue("jsonObject should contain Indiana property", 
                "Indianapolis".equals(jsonObject.get("Indiana")));
    }

    @Test
    public void shouldHandleNullJSONProperty() {
        JSONObject jsonObject= null;
        Properties properties = Property.toProperties(jsonObject);
        assertTrue("properties should be empty", 
                properties.size() == 0);
    }

    @Test
    public void shouldHandleJSONProperty() {
        Properties properties = new Properties();
        
        properties.put("Illinois", "Springfield");
        properties.put("Missouri", "Jefferson City");
        properties.put("Washington", "Olympia");
        properties.put("California", "Sacramento");
        properties.put("Indiana", "Indianapolis");

        JSONObject jsonObject = Property.toJSONObject(properties);
        Properties jsonProperties = Property.toProperties(jsonObject);

        assertTrue("property objects should match", 
                properties.equals(jsonProperties));
    }
}
@@ -157,14 +157,9 @@
 erty
-.java
 %0A
+
  */%0A
@@ -183,24 +183,131 @@
 ertyTest %7B%0A%0A
+    /**%0A     * JSONObject from null properties object should%0A     * result in an empty JSONObject.%0A     */%0A
     @Test%0A  
@@ -343,33 +343,32 @@
 lProperties() %7B%0A
-%0A
         Properti
@@ -531,32 +531,140 @@
 ) == 0);%0A    %7D%0A%0A
+    /**%0A     * JSONObject from empty properties object should%0A     * result in an empty JSONObject.%0A     */%0A
     @Test%0A    pu
@@ -705,17 +705,16 @@
 ies() %7B%0A
-%0A
         
@@ -897,32 +897,97 @@
 ) == 0);%0A    %7D%0A%0A
+    /**%0A     * JSONObject from simple properties object.%0A     */%0A
     @Test%0A    pu
@@ -2165,32 +2165,138 @@
 ana%22)));%0A    %7D%0A%0A
+    /**%0A     * Null JSONObject toProperties() should result in an empty%0A     * Properties object.%0A     */%0A
     @Test%0A    pu
@@ -2536,24 +2536,136 @@
  0);%0A    %7D%0A%0A
+    /**%0A     * Properties should convert to JSONObject, and back to%0A     * Properties without changing.%0A     */%0A
     @Test%0A  

Add method comments so JavaDoc will pick them up.