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(10);
    
    NumberDocument s_one = (NumberDocument) data.get(SampleData.SPEED_ONE);
    
    NumberDocument product = (NumberDocument) data.get("Speed One Time + Speed Two Time + Speed two irregular time");
    
    assertNotNull(product);
    
    System.out.println("name:" + product);
    
    selection.add(product);
    ChartSet model = ShowInStackedChartsOverview.createModelFor(selection);
    
    List<ICommand> actions = new ShowInStackedChartsOverview("Show in stacked charts").actionsFor(selection, data, context);
    
    System.out.println("actions:" + actions);
    
  }

}

@@ -713,91 +713,10 @@
 ata(
-10);%0A    %0A    NumberDocument s_one = (NumberDocument) data.get(SampleData.SPEED_ONE
+20
 );%0A 
@@ -837,16 +837,139 @@
 time%22);%0A
+    assertEquals(%2217 values%22, 17, product.size());%0A    assertEquals(%2217 indices%22, 17, product.getIndexValues().getSize());%0A
     %0A   
@@ -1002,55 +1002,63 @@
    %0A
+//
     
-System.out.println(%22name:%22 + product
+selection.add(s_one
 );%0A
+//
     
+selection.add(s_two);
 %0A   
@@ -1158,16 +1158,42 @@
 ction);%0A
+    assertNotNull(model);%0A
     %0A   
@@ -1322,52 +1322,140 @@
     
-%0A    System.out.println(%22actions:%22 +
+assertNotNull(%22actions returned%22, actions);%0A    assertEquals(%22has an action%22, 1, actions.size());%0A    %0A    ICommand theAct =
  actions
 );%0A 
@@ -1450,23 +1450,46 @@
  actions
+.get(0
 );%0A    
+theAct.execute();
 %0A  %7D%0A%0A%7D%0A

improve testing (to investigate specific data generation issue)