reports-service рефакторинг теста AbstractReportCollectorTest
This commit is contained in:
parent
66d013d554
commit
90b5a8ad17
1 changed files with 6 additions and 10 deletions
|
|
@ -9,11 +9,11 @@ import java.time.LocalDate;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class ReportDataCollectorTest extends ReportWithPeriodCollector {
|
class AbstractReportCollectorTest extends AbstractReportCollector {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testToString() {
|
void testToString() {
|
||||||
ReportDataCollectorTest instance = new ReportDataCollectorTest();
|
AbstractReportCollectorTest instance = new AbstractReportCollectorTest();
|
||||||
assertEquals(null, instance.toString((Long) null));
|
assertEquals(null, instance.toString((Long) null));
|
||||||
assertEquals("1", instance.toString((Long) 1L));
|
assertEquals("1", instance.toString((Long) 1L));
|
||||||
assertEquals("1230", instance.toString((Long) 1230L));
|
assertEquals("1230", instance.toString((Long) 1230L));
|
||||||
|
|
@ -22,7 +22,7 @@ class ReportDataCollectorTest extends ReportWithPeriodCollector {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testToString1() {
|
void testToString1() {
|
||||||
ReportDataCollectorTest instance = new ReportDataCollectorTest();
|
AbstractReportCollectorTest instance = new AbstractReportCollectorTest();
|
||||||
assertEquals(null, instance.toString((Instant) null));
|
assertEquals(null, instance.toString((Instant) null));
|
||||||
Instant val = Instant.ofEpochMilli(1672058774338L);
|
Instant val = Instant.ofEpochMilli(1672058774338L);
|
||||||
assertEquals("26.12.2022T15:46:14", instance.toString(val)); // msk timezone
|
assertEquals("26.12.2022T15:46:14", instance.toString(val)); // msk timezone
|
||||||
|
|
@ -30,14 +30,14 @@ class ReportDataCollectorTest extends ReportWithPeriodCollector {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testToString2() {
|
void testToString2() {
|
||||||
ReportDataCollectorTest instance = new ReportDataCollectorTest();
|
AbstractReportCollectorTest instance = new AbstractReportCollectorTest();
|
||||||
LocalDate val = LocalDate.of(2022, 12, 26);
|
LocalDate val = LocalDate.of(2022, 12, 26);
|
||||||
assertEquals("26.12.2022", instance.toString(val));
|
assertEquals("26.12.2022", instance.toString(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testToString3() {
|
void testToString3() {
|
||||||
ReportDataCollectorTest instance = new ReportDataCollectorTest();
|
AbstractReportCollectorTest instance = new AbstractReportCollectorTest();
|
||||||
assertEquals(null, instance.toString((BigDecimal)null));
|
assertEquals(null, instance.toString((BigDecimal)null));
|
||||||
assertEquals("0.00", instance.toString(BigDecimal.ZERO));
|
assertEquals("0.00", instance.toString(BigDecimal.ZERO));
|
||||||
assertEquals("1.10", instance.toString(BigDecimal.valueOf(1.10)));
|
assertEquals("1.10", instance.toString(BigDecimal.valueOf(1.10)));
|
||||||
|
|
@ -48,7 +48,7 @@ class ReportDataCollectorTest extends ReportWithPeriodCollector {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testToString4() {
|
void testToString4() {
|
||||||
ReportDataCollectorTest instance = new ReportDataCollectorTest();
|
AbstractReportCollectorTest instance = new AbstractReportCollectorTest();
|
||||||
assertEquals(null, instance.toString((Double) null));
|
assertEquals(null, instance.toString((Double) null));
|
||||||
assertEquals("0.00", instance.toString(0.0));
|
assertEquals("0.00", instance.toString(0.0));
|
||||||
assertEquals("1.10", instance.toString(1.10));
|
assertEquals("1.10", instance.toString(1.10));
|
||||||
|
|
@ -57,10 +57,6 @@ class ReportDataCollectorTest extends ReportWithPeriodCollector {
|
||||||
assertEquals("100.13", instance.toString(100.125012));
|
assertEquals("100.13", instance.toString(100.125012));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractReport collectReportWithPeriod(LocalDate startDate, LocalDate endDate) {
|
|
||||||
throw new IllegalStateException("test");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<AbstractReport> getReportClass() {
|
public Class<AbstractReport> getReportClass() {
|
||||||
Loading…
Add table
Reference in a new issue