mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
SPRINT-12: more tests fixed
This commit is contained in:
@ -27,6 +27,7 @@ import java.util.List;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ChartData;
|
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ChartData;
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer
|
|||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@Override
|
@Override
|
||||||
public Object render(RenderWidgetInput input) throws QException
|
public RenderWidgetOutput render(RenderWidgetInput input) throws QException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -61,7 +62,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer
|
|||||||
labels.add("May 2022");
|
labels.add("May 2022");
|
||||||
data.add(64);
|
data.add(64);
|
||||||
|
|
||||||
return (new ChartData("Persons created per Month", null, "Person records", labels, data));
|
return (new RenderWidgetOutput(new ChartData("Persons created per Month", null, "Person records", labels, data)));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,8 @@ package com.kingsrook.sampleapp.dashboard.widgets;
|
|||||||
|
|
||||||
|
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ChartData;
|
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.ChartData;
|
||||||
import com.kingsrook.sampleapp.SampleMetaDataProvider;
|
import com.kingsrook.sampleapp.SampleMetaDataProvider;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -43,9 +45,9 @@ class PersonsByCreateDateBarChartTest
|
|||||||
@Test
|
@Test
|
||||||
void test() throws QException
|
void test() throws QException
|
||||||
{
|
{
|
||||||
Object widgetData = new PersonsByCreateDateBarChart().render(SampleMetaDataProvider.defineInstance());
|
RenderWidgetOutput output = new PersonsByCreateDateBarChart().render(new RenderWidgetInput(SampleMetaDataProvider.defineInstance()));
|
||||||
assertThat(widgetData).isInstanceOf(ChartData.class);
|
assertThat(output.getWidgetData()).isInstanceOf(ChartData.class);
|
||||||
ChartData chartData = (ChartData) widgetData;
|
ChartData chartData = (ChartData) output.getWidgetData();
|
||||||
assertEquals("barChart", chartData.getType());
|
assertEquals("barChart", chartData.getType());
|
||||||
assertThat(chartData.getTitle()).isNotBlank();
|
assertThat(chartData.getTitle()).isNotBlank();
|
||||||
assertNotNull(chartData.getChartData());
|
assertNotNull(chartData.getChartData());
|
||||||
|
Reference in New Issue
Block a user