{"id":12664,"date":"2014-08-05T15:00:28","date_gmt":"2014-08-05T12:00:28","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=12664"},"modified":"2019-03-21T12:50:23","modified_gmt":"2019-03-21T10:50:23","slug":"junit-annotations-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/","title":{"rendered":"JUnit Annotations Example"},"content":{"rendered":"<p>JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit.<\/p>\n<p>JUnit 4 has been updated, and on the latest version supports annotations for the testing methods. Annotations are a big change from JUnit 3 to JUnit 4, and compared to the previous version, JUnit 4 has also introduced <code>@BeforeClass<\/code> and <code>@AfterClass<\/code>methods which have to be declared as static methods.<\/p>\n<p>This example will help us understand the JUnit Annotations and will explain their basic use and basic meaning.\n<\/p>\n<h2>1. Junit Annotations<\/h2>\n<p>Before we code our example, let&#8217;s take a look at the following table. This table describes the JUnit Annotations and gives an overview of the most important available annotations, showing their meaning and use.<\/p>\n<table border=\"2\">\n<tbody>\n<tr>\n<td><code><strong> @Test<\/strong><br \/>\npublic void method() <\/code><\/td>\n<td>The Test annotation indicates that the public void method to which it is attached can be run as a test case.<\/td>\n<\/tr>\n<tr>\n<td><code><strong> @Before<\/strong><br \/>\npublic void method() <\/code><\/td>\n<td>The Before annotation indicates that this method must be executed before each test in the class, so as to execute some preconditions necessary for the test.<\/td>\n<\/tr>\n<tr>\n<td><code><strong> @BeforeClass<\/strong><br \/>\npublic static void method() <\/code><\/td>\n<td>The BeforeClass annotation indicates that the static method to which is attached must be executed once and before all tests in the class. That happens when the test methods share computationally expensive setup (e.g. connect to database).<\/td>\n<\/tr>\n<tr>\n<td><code><strong> @After<\/strong><br \/>\npublic void method() <\/code><\/td>\n<td>The After annotation indicates that this method gets executed after execution of each test (e.g. reset some variables after execution of every test, delete temporary variables etc)<\/td>\n<\/tr>\n<tr>\n<td><code><strong> @AfterClass<\/strong><br \/>\npublic static void method() <\/code><\/td>\n<td>The AfterClass annotation can be used when a method needs to be executed after executing all the tests in a JUnit Test Case class so as to clean-up the expensive set-up (e.g disconnect from a database). Attention: The method attached with this annotation (similar to BeforeClass) must be defined as static.<\/td>\n<\/tr>\n<tr>\n<td><code><strong> @Ignores<\/strong><br \/>\npublic static void method() <\/code><\/td>\n<td>The Ignore annotation can be used when you want temporarily disable the execution of a specific test. Every method that is annotated with <code>@Ignore<\/code> won\u2019t be executed.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2. Basic Java Class to be tested<\/h2>\n<p>Here we have our basic Java Class that we need to test. We are going to use a simple example regarding Account balances.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><em><span style=\"text-decoration: underline\">Account.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.core.junit;\n\npublic class Account {\n\tprivate double balance;\n\n\tpublic Account(double balance) {\n\t\tthis.balance = balance;\n\t}\n\n\tpublic double getBalance() {\n\t\treturn balance;\n\t}\n\n\tpublic void setBalance(double balance) {\n\t\tthis.balance = balance;\n\t}\n\n\tpublic void withdraw(double withdrawAmount) {\n\t\tthis.balance = balance - withdrawAmount;\n\t}\n\n\tpublic void deposit(double depositAmount) {\n\t\tthis.balance = balance + depositAmount;\n\t}\n}<\/pre>\n<h2>3. Test Case<\/h2>\n<p>Here we have our test case for the <code>Account.class<\/code> Java Class.This test class includes all the basic annotations mentioned above.<\/p>\n<p><em><span style=\"text-decoration: underline\">AccountTest.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.core.junit;\nimport org.junit.*;\n\npublic class AccountTest extends Assert {\n\tprivate Account account;\n\tprivate static double balance;\n\n\t@BeforeClass\n\tpublic static void BeforeClass() {\n\t\tbalance = 100;\n\t\tSystem.out.println(\"BeforeClass\");\n\t}\n\n\t@Before\n\tpublic void setUp() throws Exception {\n\t\taccount = new Account(balance);\n\t}\n\n\t@Test\n\tpublic void balanceForAccount() {\n\t\tAssert.assertEquals(\"Test balance\", account.getBalance(), balance, 0);\n\t\tSystem.out.println(\"Test balance. Balance: \" + account.getBalance());\n\t}\n\n\t@Test\n\tpublic void testOneDeposit() {\n\t\taccount.deposit(20);\n\t\tAssert.assertEquals(\"Test deposit\", account.getBalance(), balance, 20);\n\t\tSystem.out.println(\"Test deposit. Balance: \" + account.getBalance());\n\t}\n\n\t@Test\n\tpublic void testManyDeposits() {\n\t\taccount.deposit(20);\n\t\taccount.deposit(10);\n\t\tAssert.assertEquals(\"Test many deposits\", account.getBalance(), balance, 30);\n\t\tSystem.out.println(\"Test many deposits. Balance: \" + account.getBalance());\n\t}\n\n\t@Test\n\tpublic void testOneWithdraw() {\n\t\taccount.withdraw(20);\n\t\tAssert.assertEquals(\"Test withdraw\", account.getBalance(), balance, 20);\n\t\tSystem.out.println(\"Test withdraw. Balance: \" + account.getBalance());\n\t}\n\n\t@Test\n\tpublic void testManyWithdraws() {\n\t\taccount.withdraw(20);\n\t\taccount.withdraw(10);\n\t\tAssert.assertEquals(\"Test many withdraws\", account.getBalance(), balance, 30);\n\t\tSystem.out.println(\"Test many withdraws. Balance: \" + account.getBalance());\n\t}\n\n\t@After\n\tpublic void tearDown() throws Exception {\n\t\taccount = null;\n\t\tSystem.out.println(\"tearDown\");\n\t}\n\n\t@AfterClass\n\tpublic static void AfterClass() {\n\t\tbalance = 0;\n\t\tSystem.out.println(\"AfterClass\");\n\t}\n\n\t@Ignore\n\tpublic void executionIgnored() {\n\t\tSystem.out.println(\"@Ignore: This execution is ignored\");\n\t}\n}<\/pre>\n<h2>4. Run the Test Case<\/h2>\n<p>Here is the output of our test case. As we can see, the sequence of the executed test methods, complies with what we descibed in the annotations table.This JUnit test is fully passed.[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">BeforeClass\nTest balance. Balance: 100.0\ntearDown\nTest deposit. Balance: 120.0\ntearDown\nTest many deposits. Balance: 130.0\ntearDown\nTest withdraw. Balance: 80.0\ntearDown\nTest many withdraws. Balance: 70.0\ntearDown\nAfterClass<\/pre>\n<h2>Download the example<\/h2>\n<p>This was an example of JUnit Annotations.<\/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\/2014\/08\/JUnitAnnotationsExample.zip\">JUnitAnnotationsExample.zip<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit. JUnit 4 has been updated, and on the latest version supports annotations for the &hellip;<\/p>\n","protected":false},"author":14,"featured_media":6678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-12664","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit Annotations Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of\" \/>\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-annotations-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Annotations Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-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:published_time\" content=\"2014-08-05T12:00:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-21T10:50:23+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=\"Chryssa Aliferi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chryssa Aliferi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 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-annotations-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/\"},\"author\":{\"name\":\"Chryssa Aliferi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\"},\"headline\":\"JUnit Annotations Example\",\"datePublished\":\"2014-08-05T12:00:28+00:00\",\"dateModified\":\"2019-03-21T10:50:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/\"},\"wordCount\":456,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/\",\"name\":\"JUnit Annotations Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2014-08-05T12:00:28+00:00\",\"dateModified\":\"2019-03-21T10:50:23+00:00\",\"description\":\"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-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-annotations-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 Annotations 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\/863144453b9fc15d4184d71833dcf332\",\"name\":\"Chryssa Aliferi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"caption\":\"Chryssa Aliferi\"},\"description\":\"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JUnit Annotations Example - Java Code Geeks","description":"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of","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-annotations-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Annotations Example - Java Code Geeks","og_description":"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-08-05T12:00:28+00:00","article_modified_time":"2019-03-21T10:50:23+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":"Chryssa Aliferi","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Chryssa Aliferi","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/"},"author":{"name":"Chryssa Aliferi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332"},"headline":"JUnit Annotations Example","datePublished":"2014-08-05T12:00:28+00:00","dateModified":"2019-03-21T10:50:23+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/"},"wordCount":456,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/","name":"JUnit Annotations Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2014-08-05T12:00:28+00:00","dateModified":"2019-03-21T10:50:23+00:00","description":"JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-annotations-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-annotations-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 Annotations 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\/863144453b9fc15d4184d71833dcf332","name":"Chryssa Aliferi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","caption":"Chryssa Aliferi"},"description":"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/12664","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\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=12664"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/12664\/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=12664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=12664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=12664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}