From 3ac6b34963123c05cd21c06a8c1980d5100de99a Mon Sep 17 00:00:00 2001 From: Tim Chamberlain Date: Fri, 23 Sep 2022 17:00:52 -0500 Subject: [PATCH] SPRINT-12: more tests fixed --- .../qqq/backend/javalin/PersonsByCreateDateBarChart.java | 5 +++-- .../widgets/PersonsByCreateDateBarChartTest.java | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qqq-middleware-javalin/src/test/java/com/kingsrook/qqq/backend/javalin/PersonsByCreateDateBarChart.java b/qqq-middleware-javalin/src/test/java/com/kingsrook/qqq/backend/javalin/PersonsByCreateDateBarChart.java index d300f945..7b50f790 100644 --- a/qqq-middleware-javalin/src/test/java/com/kingsrook/qqq/backend/javalin/PersonsByCreateDateBarChart.java +++ b/qqq-middleware-javalin/src/test/java/com/kingsrook/qqq/backend/javalin/PersonsByCreateDateBarChart.java @@ -27,6 +27,7 @@ import java.util.List; import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer; 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; @@ -39,7 +40,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer ** *******************************************************************************/ @Override - public Object render(RenderWidgetInput input) throws QException + public RenderWidgetOutput render(RenderWidgetInput input) throws QException { try { @@ -61,7 +62,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer labels.add("May 2022"); 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) { diff --git a/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/PersonsByCreateDateBarChartTest.java b/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/PersonsByCreateDateBarChartTest.java index 88bce47e..b28eb4d1 100644 --- a/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/PersonsByCreateDateBarChartTest.java +++ b/qqq-sample-project/src/test/java/com/kingsrook/sampleapp/dashboard/widgets/PersonsByCreateDateBarChartTest.java @@ -23,6 +23,8 @@ package com.kingsrook.sampleapp.dashboard.widgets; 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.sampleapp.SampleMetaDataProvider; import org.junit.jupiter.api.Test; @@ -43,9 +45,9 @@ class PersonsByCreateDateBarChartTest @Test void test() throws QException { - Object widgetData = new PersonsByCreateDateBarChart().render(SampleMetaDataProvider.defineInstance()); - assertThat(widgetData).isInstanceOf(ChartData.class); - ChartData chartData = (ChartData) widgetData; + RenderWidgetOutput output = new PersonsByCreateDateBarChart().render(new RenderWidgetInput(SampleMetaDataProvider.defineInstance())); + assertThat(output.getWidgetData()).isInstanceOf(ChartData.class); + ChartData chartData = (ChartData) output.getWidgetData(); assertEquals("barChart", chartData.getType()); assertThat(chartData.getTitle()).isNotBlank(); assertNotNull(chartData.getChartData());