package info.limpet.data2;

import info.limpet.ICommand;
import info.limpet.IStoreItem;
import info.limpet.impl.MockContext;
import info.limpet.impl.NumberDocument;
import info.limpet.impl.SampleData;
import info.limpet.impl.StoreGroup;
import info.limpet.stackedcharts.model.ChartSet;
import info.limpet.ui.operations.ShowInStackedChartsOverview;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;

import org.junit.Test;

public class TestStackedCharts extends TestCase
{
 
  @Test
  public void testGenChartModel()
  {
    ArrayList<IStoreItem> selection = new ArrayList<IStoreItem>();
    MockContext context = new MockContext();
    StoreGroup data = new SampleData().getData(20);
    
    NumberDocument product = (NumberDocument) data.get("Speed One Time + Speed Two Time + Speed two irregular time");
    assertEquals("17 values", 17, product.size());
    assertEquals("17 indices", 17, product.getIndexValues().getSize());
    
    assertNotNull(product);
    
//    selection.add(s_one);
//    selection.add(s_two);
    selection.add(product);
    ChartSet model = ShowInStackedChartsOverview.createModelFor(selection);
    assertNotNull(model);
    
    List<ICommand> actions = new ShowInStackedChartsOverview("Show in stacked charts").actionsFor(selection, data, context);
    assertNotNull("actions returned", actions);
    assertEquals("has an action", 1, actions.size());
    
    ICommand theAct = actions.get(0);
    theAct.execute();
  }

}

@@ -45,83 +45,17 @@
 et.I
-Command;%0Aimport info.limpet.IStoreItem;%0Aimport info.limpet.impl.MockContext
+StoreItem
 ;%0Aim
@@ -307,31 +307,8 @@
 ist;
-%0Aimport java.util.List;
 %0A%0Aim
@@ -532,53 +532,8 @@
 ();%0A
-    MockContext context = new MockContext();%0A
     
@@ -868,64 +868,8 @@
    %0A
-//    selection.add(s_one);%0A//    selection.add(s_two);%0A
     
@@ -968,16 +968,16 @@
 ction);%0A
+
     asse
@@ -998,305 +998,8 @@
 l);%0A
-    %0A    List%3CICommand%3E actions = new ShowInStackedChartsOverview(%22Show in stacked charts%22).actionsFor(selection, data, context);%0A    assertNotNull(%22actions returned%22, actions);%0A    assertEquals(%22has an action%22, 1, actions.size());%0A    %0A    ICommand theAct = actions.get(0);%0A    theAct.execute();%0A
   %7D%0A

remove unit test that potentially pulls in UI classes