[ 
https://issues.apache.org/jira/browse/GEODE-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15282837#comment-15282837
 ] 

ASF subversion and git services commented on GEODE-1350:
--------------------------------------------------------

Commit f59497776ccc8186fe62626198cd38605fae405a in incubator-geode's branch 
refs/heads/develop from [~jens.deppe]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;h=f594977 ]

GEODE-1350: Add test category


> JUnit 4 Category plus Parameterized results in tests being skipped during 
> build
> -------------------------------------------------------------------------------
>
>                 Key: GEODE-1350
>                 URL: https://issues.apache.org/jira/browse/GEODE-1350
>             Project: Geode
>          Issue Type: Bug
>          Components: build, management
>            Reporter: Kirk Lund
>            Assignee: Jens Deppe
>
> As of JUnit 4.12, the use of Categories with the Parameterized runner is 
> broken and may not get fixed by the JUnit community.
> All Geode tests using Parameterized should be reimplemented to use 
> JUnitParamsRunner.
> Example 1 of test using JUnitParamsRunner:
> {noformat}
> @Category(UnitTest.class)
> @RunWith(JUnitParamsRunner.class)
> public class LogServiceJUnitTest {
>   @Test
>   @Parameters(method = "getToLevelParameters")
>   public void toLevelShouldReturnMatchingLog4jLevel(final int intLevel, final 
> Level level) {
>     assertThat(LogService.toLevel(intLevel)).isSameAs(level);
>   }
>   private static final Object[] getToLevelParameters() {
>     return $(
>         new Object[] { 0, Level.OFF },
>         new Object[] { 100, Level.FATAL },
>         new Object[] { 200, Level.ERROR },
>         new Object[] { 300, Level.WARN },
>         new Object[] { 400, Level.INFO },
>         new Object[] { 500, Level.DEBUG },
>         new Object[] { 600, Level.TRACE },
>         new Object[] { Integer.MAX_VALUE, Level.ALL }
>     );
>   }
> {noformat}
> Example 2 of test using JUnitParamsRunner:
> {noformat}
> @Category(UnitTest.class)
> @RunWith(JUnitParamsRunner.class)
> public class RegionEntryFactoryBuilderJUnitTest {
>   /**
>    * This method will test that the correct RegionEntryFactory is created
>    * dependent on the 5 conditionals:
>    * enableStats, enableLRU, enableDisk, enableVersion, enableOffHeap
>    */
>   @Test
>   @Parameters({
>       "VMThinRegionEntryHeapFactory,false,false,false,false,false",
>       "VMThinRegionEntryOffHeapFactory,false,false,false,false,true",
>       "VersionedThinRegionEntryHeapFactory,false,false,false,true,false",
>       "VersionedThinRegionEntryOffHeapFactory,false,false,false,true,true",
>       "VMThinDiskRegionEntryHeapFactory,false,false,true,false,false",
>       "VMThinDiskRegionEntryOffHeapFactory,false,false,true,false,true",
>       "VersionedThinDiskRegionEntryHeapFactory,false,false,true,true,false",
>       "VersionedThinDiskRegionEntryOffHeapFactory,false,false,true,true,true",
>       "VMThinLRURegionEntryHeapFactory,false,true,false,false,false",
>       "VMThinLRURegionEntryOffHeapFactory,false,true,false,false,true",
>       "VersionedThinLRURegionEntryHeapFactory,false,true,false,true,false",
>       "VersionedThinLRURegionEntryOffHeapFactory,false,true,false,true,true",
>       "VMThinDiskLRURegionEntryHeapFactory,false,true,true,false,false",
>       "VMThinDiskLRURegionEntryOffHeapFactory,false,true,true,false,true",
>       "VersionedThinDiskLRURegionEntryHeapFactory,false,true,true,true,false",
>       
> "VersionedThinDiskLRURegionEntryOffHeapFactory,false,true,true,true,true",
>       "VMStatsRegionEntryHeapFactory,true,false,false,false,false",
>       "VMStatsRegionEntryOffHeapFactory,true,false,false,false,true",
>       "VersionedStatsRegionEntryHeapFactory,true,false,false,true,false",
>       "VersionedStatsRegionEntryOffHeapFactory,true,false,false,true,true",
>       "VMStatsDiskRegionEntryHeapFactory,true,false,true,false,false",
>       "VMStatsDiskRegionEntryOffHeapFactory,true,false,true,false,true",
>       "VersionedStatsDiskRegionEntryHeapFactory,true,false,true,true,false",
>       "VersionedStatsDiskRegionEntryOffHeapFactory,true,false,true,true,true",
>       "VMStatsLRURegionEntryHeapFactory,true,true,false,false,false",
>       "VMStatsLRURegionEntryOffHeapFactory,true,true,false,false,true",
>       "VersionedStatsLRURegionEntryHeapFactory,true,true,false,true,false",
>       "VersionedStatsLRURegionEntryOffHeapFactory,true,true,false,true,true",
>       "VMStatsDiskLRURegionEntryHeapFactory,true,true,true,false,false",
>       "VMStatsDiskLRURegionEntryOffHeapFactory,true,true,true,false,true",
>       "VersionedStatsDiskLRURegionEntryHeapFactory,true,true,true,true,false",
>       
> "VersionedStatsDiskLRURegionEntryOffHeapFactory,true,true,true,true,true"
>   })
>   public void testRegionEntryFactoryUnitTest(String factoryName, boolean 
> enableStats, boolean enableLRU, boolean enableDisk,
>       boolean enableVersioning, boolean enableOffHeap) {
>     assertEquals(factoryName,
>         regionEntryFactoryBuilder.getRegionEntryFactoryOrNull(enableStats, 
> enableLRU, enableDisk, enableVersioning, 
> enableOffHeap).getClass().getSimpleName());
>   }
> {noformat}
> Example of BROKEN test using Parameterized which is skipped by our test 
> targets due to use of Categories:
> {noformat}
> @Category(IntegrationTest.class)
> @RunWith(Parameterized.class)
> public class GfshCommandsSecurityTest {
>   public GfshCommandsSecurityTest(boolean useHttp){
>     gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, useHttp);
>   }
>   @Parameterized.Parameters
>   public static Collection parameters() {
>     return Arrays.asList(new Object[][] {
>         { false},  // useHttp=false,
>         { true } // useHttp=true,
>     });
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to