/**
 * The MIT License (MIT)
 * 
 * Copyright (c) 2014 mcflugen
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package edu.colorado.csdms.wmt.client;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.gwt.junit.client.GWTTestCase;

import edu.colorado.csdms.wmt.client.data.ComponentJSO;

/**
 * Tests for {@link ComponentJSO}. JUnit integration is provided by extending
 * {@link GWTTestCase}.
 * 
 * @see http://www.gwtproject.org/doc/latest/DevGuideTesting.html
 * @see http://www.gwtproject.org/doc/latest/tutorial/JUnit.html
 * @see http://blog.danielwellman.com/2008/08/testing-json-parsing-using-javascript-overlay-types-in-gwt-15.html
 * @author Mark Piper (mark.piper@colorado.edu)
 */
public class ComponentJSOTest extends GWTTestCase {

  private ComponentJSO componentJSO;
  private String id;
  private String componentClass;
  private String name;  
  
  /**
   * The module that sources this class. Must be present.
   */
  @Override
  public String getModuleName() {
     return "edu.colorado.csdms.wmt.WMT";
  }
  
  /**
   * A JSNI method that defines a fixture for the tests. Returns a
   * {@link ComponentJSO} object for testing.
   * 
   * @param id
   * @param componentClass
   * @param name
   */
  private native ComponentJSO testComponentJSO(String id, String componentClass,
      String name) /*-{
		return {
			"id" : id,
			"class" : componentClass,
			"name" : name
		}
  }-*/;  
  
  @Before
  @Override
  protected void gwtSetUp() throws Exception {
    id = "child";
    componentClass = "Child";
    name = "Child_0";
    componentJSO = testComponentJSO(id, componentClass, name);
  }

  @After
  @Override
  protected void gwtTearDown() throws Exception {
  }

  @Test
  public void testGetId() {
    assertEquals(id, componentJSO.getId());
  }

  @Test
  public void testGetComponentClass() {
    assertEquals(componentClass, componentJSO.getComponentClass());
  }
  
  @Test
  public void testGetName() {
    assertEquals(name, componentJSO.getName());
  }
}

@@ -1,1150 +1,4 @@
-/**%0A * The MIT License (MIT)%0A * %0A * Copyright (c) 2014 mcflugen%0A * %0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A * %0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A * %0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE%0A * SOFTWARE.%0A */%0A
 pack
@@ -784,18 +784,47 @@
 ng name;
+%0A
   
+private Integer nParameters;
 %0A  %0A  /*
@@ -1349,16 +1349,124 @@
 %22 : name
+,%0A%09%09%09%22parameters%22 : %5B%0A%09%09%09  %7B%0A%09%09%09    %22key%22:%22separator%22%0A%09%09%09  %7D,%0A%09%09%09  %7B%0A%09%09%09    %22key%22:%22run_duration%22%0A%09%09%09  %7D%0A%09%09%09%5D
 %0A%09%09%7D%0A  %7D
@@ -1614,16 +1614,37 @@
 ild_0%22;%0A
+    nParameters = 2;%0A
     comp
@@ -2021,24 +2021,24 @@
 GetName() %7B%0A
-
     assertEq
@@ -2076,11 +2076,146 @@
 ());%0A  %7D
+%0A%0A  @Test%0A  public void testNParameters() %7B%0A    Integer actual = componentJSO.nParameters();%0A    assertEquals(nParameters, actual);%0A  %7D
 %0A%7D%0A

Add unit test for ComponentJSO#nParameters