Enabling Static Imports for Unit Testing DSLs (#331) (#9764)

* Enabling Static Imports for Unit Testing DSLs (#331)

Co-authored-by: mohammadshoaib <mohammadshoaib@miqdigital.com>

* Feature 8885 - Enabling Static Imports for Unit Testing DSLs (#435)

* Enabling Static Imports for Unit Testing DSLs

* Using suppressions checkstyle to allow static imports only in the UTs

Co-authored-by: mohammadshoaib <mohammadshoaib@miqdigital.com>

* Removing the changes in the checkstyle because those are not needed

Co-authored-by: mohammadshoaib <mohammadshoaib@miqdigital.com>
This commit is contained in:
Mohammad Shoaib 2020-07-01 02:29:35 +05:30 committed by GitHub
parent c01fd56182
commit 84290a2332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -69,4 +69,5 @@
<suppress checks="ImportOrder" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="EmptyLineSeparator" files="[\\/]target[\\/]generated-test-sources[\\/]" />
<suppress checks="AvoidStaticImport" files="[\\/]src[\\/](test)[\\/]"/>
</suppressions>

View File

@ -23,6 +23,9 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.apache.druid.common.config.NullHandling.replaceWithDefault;
import static org.junit.Assert.assertEquals;
public class NullHandlingTest
{
@BeforeClass
@ -34,8 +37,8 @@ public class NullHandlingTest
@Test
public void test_defaultValueForClass_float()
{
Assert.assertEquals(
NullHandling.replaceWithDefault() ? 0f : null,
assertEquals(
replaceWithDefault() ? 0f : null,
NullHandling.defaultValueForClass(Float.class)
);
}
@ -43,8 +46,8 @@ public class NullHandlingTest
@Test
public void test_defaultValueForClass_double()
{
Assert.assertEquals(
NullHandling.replaceWithDefault() ? 0d : null,
assertEquals(
replaceWithDefault() ? 0d : null,
NullHandling.defaultValueForClass(Double.class)
);
}
@ -58,8 +61,8 @@ public class NullHandlingTest
@Test
public void test_defaultValueForClass_long()
{
Assert.assertEquals(
NullHandling.replaceWithDefault() ? 0L : null,
assertEquals(
replaceWithDefault() ? 0L : null,
NullHandling.defaultValueForClass(Long.class)
);
}
@ -67,8 +70,8 @@ public class NullHandlingTest
@Test
public void test_defaultValueForClass_number()
{
Assert.assertEquals(
NullHandling.replaceWithDefault() ? 0d : null,
assertEquals(
replaceWithDefault() ? 0d : null,
NullHandling.defaultValueForClass(Number.class)
);
}
@ -76,8 +79,8 @@ public class NullHandlingTest
@Test
public void test_defaultValueForClass_string()
{
Assert.assertEquals(
NullHandling.replaceWithDefault() ? "" : null,
assertEquals(
replaceWithDefault() ? "" : null,
NullHandling.defaultValueForClass(String.class)
);
}