{"id":26893,"date":"2015-09-08T15:00:08","date_gmt":"2015-09-08T12:00:08","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=26893"},"modified":"2019-03-21T12:05:09","modified_gmt":"2019-03-21T10:05:09","slug":"junit-test-order-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/","title":{"rendered":"JUnit Test Order Example"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>One of the rarely used features in JUnit is the usage of <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">@FixMethodOrder<\/a><\/code> annotation. This is primarily used to indicate an order of test method calls in a specific JUnit Test case class. This is actually not a recommended practice cause we want method calls to be independent and arbitrary in nature. Test cases method should not be dependent on each other except for integration test cases.<\/p>\n<p>Of course, this feature wouldn&#8217;t be included on the latest JUnit Library if not for it&#8217;s positive usage. Here are some examples that this feature might come in handy.<\/p>\n<ul>\n<li>Test case to execute specific service method to satisfy a functional scenario. Bad practice but in the real world application, this can be the case.<\/li>\n<li>Order of test case will also reflect on the representation in the report. It would certainly make sense from a report perspective that all test cases are defined in a specific order.<\/li>\n<\/ul>\n<h2>2. The Source<\/h2>\n<p>Here is a bit of example I made to showcase how can we order a specific test case.<\/p>\n<pre class=\"brush:java\">package com.areyes1.jgc.tests;\n\nimport org.junit.Assert;\nimport org.junit.FixMethodOrder;\nimport static org.hamcrest.CoreMatchers.*;\nimport org.junit.Test;\nimport org.junit.runners.MethodSorters;\n\n@FixMethodOrder(MethodSorters.DEFAULT)\npublic class JUnitOrderSampleServiceTests {\n\t\n\t@Test\n\tpublic void testC() {\n\t\tSystem.out.println(\"C\");\n\t\tint numberCResult = 0;\n\t\tfor (int i=0;i&lt;1000;i++) {\n\t\t\t\/\/complex loop\n\t\t\tnumberCResult++;\n\t\t\t\n\t\t}\n\t\tAssert.assertThat(numberCResult,isA(Integer.class));\n\t}\n\t\n\t@Test\n\tpublic void testA() {\n\t\tSystem.out.println(\"A\");\n\t\tint numberAResult = 0;\n\t\tfor (int i=0;i&lt;10000;i++) {\n\t\t\t\/\/complex loop\n\t\t\tnumberAResult++;\n\t\t\t\n\t\t}\n\t\tAssert.assertThat(numberAResult,isA(Integer.class));\n\t}\n\t\n\t@Test\n\tpublic void testD() {\n\t\tSystem.out.println(\"D\");\n\t\tint numberDResult = 0;\n\t\tfor (int i=0;i&lt;100000;i++) {\n\t\t\t\/\/complex loop\n\t\t\tnumberDResult++;\n\t\t\t\n\t\t}\n\t\tAssert.assertThat(numberDResult,isA(Integer.class));\n\t}\n\t\n\t@Test\n\tpublic void testB() {\n\t\tSystem.out.println(\"B\");\n\t\tint numberBResult = 0;\n\t\tfor (int i=0;i&lt;1000000;i++) {\n\t\t\t\/\/complex loop\n\t\t\tnumberBResult++;\n\t\t\t\n\t\t}\n\t\tAssert.assertThat(numberBResult,isA(Integer.class));\n\t}\n}\n<\/pre>\n<p>It starts with the annotation <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">@FixMethodOrder<\/a><\/code>. This annotation will marked the test case to run on a specific order given a sorter. There are 3 types of sorters provided by the JUnit Library, these are:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<ul>\n<li><code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.DEFAULT<\/a><\/code> &#8211; By default, the test cases will run on the matter of it&#8217;s declaration in the class. We really don&#8217;t need to specify this since this will be the default sorter. According to the documentation, the default behaviour is deterministic &#8211; means that it may very well depend on a number of factors such as object creation or even placement of declaration. It is deterministic on the virtual machine level but never predictable.<\/li>\n<li><code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.JVM<\/a><\/code> &#8211; This is arbitrary one, the order is not guaranteed as it will depend on the creation of the objects in the JVM.<\/li>\n<li><code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.NAME_ASCENDING<\/a><\/code> &#8211; This will look at the method names and sort it in ascending order (A-Z).<\/li>\n<\/ul>\n<h2>3. Results<\/h2>\n<p>Here are some of the results made from each of the orders as discussed.<\/p>\n<h3>3.1 Using <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.DEFAULT<\/a><\/code><\/h3>\n<p><figure id=\"attachment_26935\" aria-describedby=\"caption-attachment-26935\" style=\"width: 588px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_default.jpg\"><img decoding=\"async\" class=\"size-full wp-image-26935\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_default.jpg\" alt=\"Figure 1.0 MethodSorters.DEFAULT result\" width=\"588\" height=\"352\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_default.jpg 588w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_default-300x180.jpg 300w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><\/a><figcaption id=\"caption-attachment-26935\" class=\"wp-caption-text\">Figure 1.0 MethodSorters.DEFAULT result<\/figcaption><\/figure>[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<p>In this run, it uses the names of the methods in an ascending order. We didn&#8217;t enforce the NAME_ASCENDING sort in this method and it can vary in a few runs.<\/p>\n<h3>3.2 Using <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.JVM<\/a><\/code><\/h3>\n<p><figure id=\"attachment_26937\" aria-describedby=\"caption-attachment-26937\" style=\"width: 599px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_jvm.jpg\"><img decoding=\"async\" class=\"size-full wp-image-26937\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_jvm.jpg\" alt=\"Figure 2.0 MethodSorters.JVM Result\" width=\"599\" height=\"324\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_jvm.jpg 599w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_jvm-300x162.jpg 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/a><figcaption id=\"caption-attachment-26937\" class=\"wp-caption-text\">Figure 2.0 MethodSorters.JVM result<\/figcaption><\/figure><\/p>\n<p>In this run, it uses the sequence of it&#8217;s declaration on the Test case class. Indicating that the sequence was the actual creation of the methods in the stack.<\/p>\n<h3>3.3 Using <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.NAME_ASCENDING<\/a><\/code><\/h3>\n<p><figure id=\"attachment_26938\" aria-describedby=\"caption-attachment-26938\" style=\"width: 589px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_name_asc.jpg\"><img decoding=\"async\" class=\"size-full wp-image-26938\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_name_asc.jpg\" alt=\"Figure 3.0 MethodSorters.NAME_ASCENDING result\" width=\"589\" height=\"328\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_name_asc.jpg 589w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/method_sort_name_asc-300x167.jpg 300w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/a><figcaption id=\"caption-attachment-26938\" class=\"wp-caption-text\">Figure 3.0 MethodSorters.NAME_ASCENDING result<\/figcaption><\/figure><\/p>\n<p>In this run, its the same as the <code><a href=\"http:\/\/junit.org\/apidocs\/index.html?org\/junit\/FixMethodOrder.html\" target=\"_blank\" rel=\"noopener noreferrer\">MethodSorters.DEFAULT<\/a><\/code>. In this however, we are enforcing this order. The default one is completely arbitrary in nature and may not be always the case.<\/p>\n<h2>4. Download the Eclipse project<\/h2>\n<p>This was an example of JUnit Test Case Order.<\/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-test-order.zip\"><strong>junit-test-order<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test method calls in a specific JUnit Test case class. This is actually not a recommended practice cause we want method calls to be independent and arbitrary in nature. Test &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":[1032,1202,1201],"class_list":["post-26893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit","tag-junit","tag-methodsort","tag-order"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit Test Order Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test\" \/>\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-test-order-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Test Order Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-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-08T12:00:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-21T10:05:09+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=\"3 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-test-order-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/\"},\"author\":{\"name\":\"Alvin Reyes\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d\"},\"headline\":\"JUnit Test Order Example\",\"datePublished\":\"2015-09-08T12:00:08+00:00\",\"dateModified\":\"2019-03-21T10:05:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/\"},\"wordCount\":501,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"keywords\":[\"junit\",\"methodsort\",\"order\"],\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/\",\"name\":\"JUnit Test Order Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2015-09-08T12:00:08+00:00\",\"dateModified\":\"2019-03-21T10:05:09+00:00\",\"description\":\"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-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-test-order-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 Test Order 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 Test Order Example - Java Code Geeks","description":"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test","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-test-order-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Test Order Example - Java Code Geeks","og_description":"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-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-08T12:00:08+00:00","article_modified_time":"2019-03-21T10:05:09+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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/"},"author":{"name":"Alvin Reyes","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b5bc005030b168a0a95f041b047bf82d"},"headline":"JUnit Test Order Example","datePublished":"2015-09-08T12:00:08+00:00","dateModified":"2019-03-21T10:05:09+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/"},"wordCount":501,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","keywords":["junit","methodsort","order"],"articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/","name":"JUnit Test Order Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2015-09-08T12:00:08+00:00","dateModified":"2019-03-21T10:05:09+00:00","description":"1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-test-order-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-test-order-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 Test Order 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\/26893","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=26893"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/26893\/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=26893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=26893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=26893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}