SPRINT-12: fixed style issue and broken tests

This commit is contained in:
Tim Chamberlain
2022-09-23 16:21:38 -05:00
parent 5efd2da636
commit ce48933cbd
2 changed files with 48 additions and 24 deletions

View File

@ -70,26 +70,6 @@ public class QValueFormatter
/*******************************************************************************
**
*******************************************************************************/
public String formatDate(LocalDate date)
{
return (dateFormatter.format(date));
}
/*******************************************************************************
**
*******************************************************************************/
public String formatDateTime(LocalDateTime dateTime)
{
return (dateTimeFormatter.format(dateTime));
}
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@ -149,6 +129,26 @@ public class QValueFormatter
/*******************************************************************************
**
*******************************************************************************/
public String formatDate(LocalDate date)
{
return (dateFormatter.format(date));
}
/*******************************************************************************
**
*******************************************************************************/
public String formatDateTime(LocalDateTime dateTime)
{
return (dateTimeFormatter.format(dateTime));
}
/******************************************************************************* /*******************************************************************************
** Make a string from a table's recordLabelFormat and fields, for a given record. ** Make a string from a table's recordLabelFormat and fields, for a given record.
*******************************************************************************/ *******************************************************************************/

View File

@ -25,6 +25,8 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
import java.net.UnknownHostException; import java.net.UnknownHostException;
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.metadata.dashboard.QWidgetMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QuickSightChartMetaData;
import com.kingsrook.qqq.backend.core.utils.TestUtils; import com.kingsrook.qqq.backend.core.utils.TestUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
@ -42,7 +44,8 @@ class QuickSightChartRendererTest
@Test @Test
void testWrongMetaDataClass() throws QException void testWrongMetaDataClass() throws QException
{ {
assertThatThrownBy(() -> new QuickSightChartRenderer().render(new RenderWidgetInput(TestUtils.defineInstance()))) RenderWidgetInput input = getInput().withWidgetMetaData(new QWidgetMetaData());
assertThatThrownBy(() -> new QuickSightChartRenderer().render(input))
.hasRootCauseInstanceOf(ClassCastException.class); .hasRootCauseInstanceOf(ClassCastException.class);
} }
@ -54,7 +57,8 @@ class QuickSightChartRendererTest
@Test @Test
void testNoCredentials() throws QException void testNoCredentials() throws QException
{ {
assertThatThrownBy(() -> new QuickSightChartRenderer().render(new RenderWidgetInput(TestUtils.defineInstance()))) RenderWidgetInput input = getInput().withWidgetMetaData(new QuickSightChartMetaData());
assertThatThrownBy(() -> new QuickSightChartRenderer().render(input))
.hasRootCauseInstanceOf(NullPointerException.class); .hasRootCauseInstanceOf(NullPointerException.class);
} }
@ -66,8 +70,28 @@ class QuickSightChartRendererTest
@Test @Test
void testBadCredentials() throws QException void testBadCredentials() throws QException
{ {
assertThatThrownBy(() -> new QuickSightChartRenderer().render(new RenderWidgetInput(TestUtils.defineInstance()) RenderWidgetInput input = getInput().withWidgetMetaData(
)).hasRootCauseInstanceOf(UnknownHostException.class); new QuickSightChartMetaData()
.withName("test")
.withAccessKey("FAIL")
.withSecretKey("FAIL")
.withRegion("FAIL")
.withAccountId("FAIL")
);
assertThatThrownBy(() -> new QuickSightChartRenderer().render(input))
.hasRootCauseInstanceOf(UnknownHostException.class);
}
/*******************************************************************************
**
*******************************************************************************/
private RenderWidgetInput getInput()
{
return (new RenderWidgetInput(TestUtils.defineInstance()).withSession(TestUtils.getMockSession()));
} }
} }