{"id":27292,"date":"2015-09-23T15:00:36","date_gmt":"2015-09-23T12:00:36","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=27292"},"modified":"2019-03-21T12:04:41","modified_gmt":"2019-03-21T10:04:41","slug":"junit-categories-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/","title":{"rendered":"JUnit Categories Example"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from one another. In this post, I&#8217;ll showcase how easy it is to categorize unit tests by <a href=\"http:\/\/junit.org\/apidocs\/org\/junit\/experimental\/categories\/Categories.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code>@Category<\/code><\/a>.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;\n<\/p>\n<h2>2. Maven Project and Configuration<\/h2>\n<p><span style=\"text-decoration: underline\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;com.jgc.areyes.junit&lt;\/groupId&gt;\n\t&lt;artifactId&gt;junit-categories-example&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t&lt;build&gt;\n\t\t&lt;plugins&gt;\n\t\t\t&lt;plugin&gt;\n\t\t\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n\t\t\t\t&lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\n\t\t\t\t&lt;version&gt;2.17&lt;\/version&gt;\n\t\t\t\t&lt;dependencies&gt;\n\t\t\t\t\t&lt;dependency&gt;\n\t\t\t\t\t\t&lt;groupId&gt;org.apache.maven.surefire&lt;\/groupId&gt;\n\t\t\t\t\t\t&lt;artifactId&gt;surefire-junit47&lt;\/artifactId&gt;\n\t\t\t\t\t\t&lt;version&gt;2.17&lt;\/version&gt;\n\t\t\t\t\t&lt;\/dependency&gt;\n\t\t\t\t&lt;\/dependencies&gt;\n\t\t\t&lt;\/plugin&gt;\n\t\t&lt;\/plugins&gt;\n\t&lt;\/build&gt;\n\t&lt;dependencies&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;junit&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;junit&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;4.12&lt;\/version&gt;\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\n\t\t&lt;\/dependency&gt;\n\t&lt;\/dependencies&gt;\n&lt;\/project&gt;\n<\/pre>\n<h2>3. Source code sample<\/h2>\n<p>Define the interfaces first. In order for us to group test cases, we need to create a unifier\/union on them. We use <code>interface<\/code> class to tag a specific class or method to a group. Here are the interfaces that we will use in this example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Interfaces<\/em><\/span><\/p>\n<pre class=\"brush:java\">public interface FunctionalGroupTests1 {}\npublic interface FunctionalGroupTests2 {}\npublic interface IntegrationTests {}\npublic interface SanityTests {}\n<\/pre>\n<p>We then use those interfaces on our test cases. This will differentiate the test case for our own test purposes. In the example below, we tag tests method by category using the <a href=\"http:\/\/junit.org\/apidocs\/org\/junit\/experimental\/categories\/Categories.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code>@Category<\/code><\/a> annotation<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>JUnitTestCategoryExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.areyes.junit.svc;\n\nimport static org.hamcrest.CoreMatchers.isA;\nimport static org.junit.Assert.*;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\n\nimport com.areyes.junit.cat.intf.FunctionalGroupTests1;\nimport com.areyes.junit.cat.intf.FunctionalGroupTests2;\nimport com.areyes.junit.cat.intf.IntegrationTests;\nimport com.areyes.junit.cat.intf.SanityTests;\n\npublic class JUnitTestCategoryExample {\n\n\t@Test @Category(FunctionalGroupTests1.class)\n\tpublic void testFunctionalTests1Test1() {\n\t\t\/\/\tYou're test case here: Below is just an example.\n\t\tint numberInLoop = 0;\n\t\tfor (int i=0;i&lt;1000;i++) {\n\t\t\tnumberInLoop++;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(\"FunctionalGroupTests1: testFunctionalTests1Test1\");\n\t\tAssert.assertThat(numberInLoop,isA(Integer.class));\n\t}\n\t\n\t@Test @Category(FunctionalGroupTests1.class)\n\tpublic void testFunctionalTests1Test2() {\n\t\t\/\/\tYou're test case here: Below is just an example.\n\t\tint numberInLoop = 0;\n\t\tfor (int i=1000;i&lt;4000;i++) {\n\t\t\tnumberInLoop++;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(\"FunctionalGroupTests1: testFunctionalTests1Test2\");\n\t\tAssert.assertThat(numberInLoop,isA(Integer.class));\n\t}\n\t\n\t@Test @Category(FunctionalGroupTests2.class)\n\tpublic void testFunctionalTests2Test1() {\n\t\t\/\/\tYou're test case here: Below is just an example.\n\t\tint numberInLoop = 0;\n\t\tdo{\n\t\t\tnumberInLoop++;\n\t\t}while(numberInLoop != 1000);\n\t\tSystem.out.println(\"FunctionalGroupTests2: testFunctionalTests2Test1\");\n\t\tAssert.assertThat(numberInLoop,isA(Integer.class));\n\t}\n\t\n\t@Test @Category(FunctionalGroupTests2.class)\n\tpublic void testFunctionalTests2Test2() {\n\t\tSystem.out.println(\"FunctionalGroupTests2: testFunctionalTests2Test2\");\n\t}\n\n\t@Test @Category({IntegrationTests.class,FunctionalGroupTests1.class})\n\tpublic void testIntegrationTestsTest1() {\n\t\tSystem.out.println(\"IntegrationTests: testIntegrationTestsTest1\");\n\t}\n\t\n\t@Test @Category(SanityTests.class)\n\tpublic void testSanityTestsTest1() {\n\t\tSystem.out.println(\"SanityTests: testSanityTestsTest1\");\n\t}\t\n}\n<\/pre>\n<h2>4. Running our example<\/h2>\n<h3>4.1 Running Tests by Category<\/h3>\n<p>We can run specific test case category by running the commands in Maven below. <code>mvn test -Dgroups=\"com.areyes.junit.cat.intf.FunctionalGroupTests1, com.areyes.junit.cat.intf.FunctionalGroupTests2\"<\/code><br \/>\n<code>mvn test -Dgroups=\"com.areyes.junit.cat.intf.IntegrationTests, com.areyes.junit.cat.intf.SanityTests\"<\/code>[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<h3>4.2 Running tests by Category Profile<\/h3>\n<p>Alternatively, we can run tests by profile. We need to update our pom.xml and add a new profiles. We will then use these profiles and tag the categories we created to each as shown below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;com.jgc.areyes.junit&lt;\/groupId&gt;\n\t&lt;artifactId&gt;junit-categories-example&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t&lt;build&gt;\n\t\t&lt;plugins&gt;\n\t\t\t&lt;plugin&gt;\n\t\t\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n\t\t\t\t&lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\n\t\t\t\t&lt;version&gt;2.17&lt;\/version&gt;\n\t\t\t\t&lt;dependencies&gt;\n\t\t\t\t\t&lt;dependency&gt;\n\t\t\t\t\t\t&lt;groupId&gt;org.apache.maven.surefire&lt;\/groupId&gt;\n\t\t\t\t\t\t&lt;artifactId&gt;surefire-junit47&lt;\/artifactId&gt;\n\t\t\t\t\t\t&lt;version&gt;2.17&lt;\/version&gt;\n\t\t\t\t\t&lt;\/dependency&gt;\n\t\t\t\t&lt;\/dependencies&gt;\n\t\t\t\t&lt;configuration&gt;\n\t\t\t\t\t&lt;groups&gt;${testcase.groups}&lt;\/groups&gt;\n\t\t\t\t\t&lt;excludes&gt;\n\t\t\t\t\t\t&lt;exclude&gt;${exclude.tests}&lt;\/exclude&gt;\n\t\t\t\t\t&lt;\/excludes&gt;\n\t\t\t\t\t&lt;includes&gt;\n\t\t\t\t\t\t&lt;include&gt;${include.tests}&lt;\/include&gt;\n\t\t\t\t\t&lt;\/includes&gt;\n\t\t\t\t&lt;\/configuration&gt;\n\t\t\t&lt;\/plugin&gt;\n\t\t&lt;\/plugins&gt;\n\t&lt;\/build&gt;\n\t&lt;profiles&gt;\n\t    &lt;profile&gt;\n\t        &lt;id&gt;sanityTests&lt;\/id&gt;\n\t        &lt;properties&gt;\n\t            &lt;testcase.groups&gt;com.areyes.junit.svc.SanityTests&lt;\/testcase.groups&gt;\n\t        &lt;\/properties&gt;\n\t    &lt;\/profile&gt;\n\t    &lt;profile&gt;\n\t        &lt;id&gt;functionalGroupTests1&lt;\/id&gt;\n\t        &lt;properties&gt;\n\t            &lt;testcase.groups&gt;com.areyes.junit.svc.FunctionalGroupTests1&lt;\/testcase.groups&gt;\n\t        &lt;\/properties&gt;\n\t    &lt;\/profile&gt;\n\t    &lt;profile&gt;\n\t        &lt;id&gt;functionalGroupTests2&lt;\/id&gt;\n\t        &lt;properties&gt;\n\t            &lt;testcase.groups&gt;com.areyes.junit.svc.FunctionalGroupTests2&lt;\/testcase.groups&gt;\n\t        &lt;\/properties&gt;\n\t    &lt;\/profile&gt;\n\t    &lt;profile&gt;\n\t        &lt;id&gt;integrationTests&lt;\/id&gt;\n\t        &lt;properties&gt;\n\t            &lt;testcase.groups&gt;com.areyes.junit.svc.IntegrationTests&lt;\/testcase.groups&gt;\n\t        &lt;\/properties&gt;\n\t    &lt;\/profile&gt;\n\t&lt;\/profiles&gt;\n\t\n\t&lt;dependencies&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;junit&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;junit&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;4.12&lt;\/version&gt;\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\n\t\t&lt;\/dependency&gt;\n\t&lt;\/dependencies&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>Run them by using the following maven command: <code>mvn test -pfunctionalGroupTests1<\/code><\/p>\n<h2>5. Download the Eclipse project<\/h2>\n<p>This was an example of JUnit Category.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/junit-categories-example.zip\"><strong>junit-categories-example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from one another. In this post, I&#8217;ll showcase how easy it is to categorize unit tests by @Category. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2. Maven Project and Configuration pom.xml &lt;project xmlns=&#8221;http:\/\/maven.apache.org\/POM\/4.0.0&#8243; xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; &hellip;<\/p>\n","protected":false},"author":41,"featured_media":6678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[1219,1220,1032],"class_list":["post-27292","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit","tag-category","tag-example","tag-junit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit Categories Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Categories Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/alvinjayreyes\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-23T12:00:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-21T10:04:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alvin Reyes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@alvinjayreyes\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alvin Reyes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\"},\"author\":{\"name\":\"Alvin Reyes\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d\"},\"headline\":\"JUnit Categories Example\",\"datePublished\":\"2015-09-23T12:00:36+00:00\",\"dateModified\":\"2019-03-21T10:04:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\"},\"wordCount\":238,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"keywords\":[\"category\",\"example\",\"junit\"],\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\",\"name\":\"JUnit Categories Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2015-09-23T12:00:36+00:00\",\"dateModified\":\"2019-03-21T10:04:41+00:00\",\"description\":\"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"junit\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JUnit Categories Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d\",\"name\":\"Alvin Reyes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/Alvin-Reyes-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/Alvin-Reyes-96x96.jpg\",\"caption\":\"Alvin Reyes\"},\"description\":\"Alvin has an Information Technology Degree from Mapua Institute of Technology. During his studies, he was already heavily involved in a number of small to large projects where he primarily contributes by doing programming, analysis design. After graduating, he continued to do side projects on Mobile, Desktop and Web Applications.\",\"sameAs\":[\"http:\/\/www.alvinjayreyes.com\",\"https:\/\/www.facebook.com\/alvinjayreyes\",\"http:\/\/ca.linkedin.com\/in\/alvinpreyes\",\"https:\/\/x.com\/alvinjayreyes\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/alvin-reyes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JUnit Categories Example - Java Code Geeks","description":"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Categories Example - Java Code Geeks","og_description":"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/alvinjayreyes","article_published_time":"2015-09-23T12:00:36+00:00","article_modified_time":"2019-03-21T10:04:41+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","type":"image\/jpeg"}],"author":"Alvin Reyes","twitter_card":"summary_large_image","twitter_creator":"@alvinjayreyes","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Alvin Reyes","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/"},"author":{"name":"Alvin Reyes","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d"},"headline":"JUnit Categories Example","datePublished":"2015-09-23T12:00:36+00:00","dateModified":"2019-03-21T10:04:41+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/"},"wordCount":238,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","keywords":["category","example","junit"],"articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/","name":"JUnit Categories Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2015-09-23T12:00:36+00:00","dateModified":"2019-03-21T10:04:41+00:00","description":"1. Introduction JUnit has an awesome feature of organizing group of test cases called Categorizing. It can help developers differentiate test cases from","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-categories-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"junit","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/"},{"@type":"ListItem","position":5,"name":"JUnit Categories Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d","name":"Alvin Reyes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/Alvin-Reyes-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/Alvin-Reyes-96x96.jpg","caption":"Alvin Reyes"},"description":"Alvin has an Information Technology Degree from Mapua Institute of Technology. During his studies, he was already heavily involved in a number of small to large projects where he primarily contributes by doing programming, analysis design. After graduating, he continued to do side projects on Mobile, Desktop and Web Applications.","sameAs":["http:\/\/www.alvinjayreyes.com","https:\/\/www.facebook.com\/alvinjayreyes","http:\/\/ca.linkedin.com\/in\/alvinpreyes","https:\/\/x.com\/alvinjayreyes"],"url":"https:\/\/examples.javacodegeeks.com\/author\/alvin-reyes\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/27292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=27292"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/27292\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/6678"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=27292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=27292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=27292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}