{"id":9043,"date":"2017-10-22T02:14:02","date_gmt":"2017-10-22T00:14:02","guid":{"rendered":"http:\/\/blog.wenzlaff.de\/?p=9043"},"modified":"2018-09-07T16:25:36","modified_gmt":"2018-09-07T14:25:36","slug":"wie-koennen-mit-junit-5-custom-composed-annotation-erstellt-werden","status":"publish","type":"post","link":"http:\/\/blog.wenzlaff.de\/?p=9043","title":{"rendered":"Wie k\u00f6nnen mit JUnit 5 Custom Composed Annotation erstellt werden?"},"content":{"rendered":"<p>Wenn man an einer zentralen Stelle Testmethoden annotieren will, geht das mit JUnit 5 \u00fcber eigene Benutzer Annotationen. Ich habe mir eine Annotation f\u00fcr Performance Test geschrieben. Z.B. kann ich sie dann zentral ausschalten:<\/p>\n<pre class=\"lang:java decode:true \" >package de.wenzlaff.umgebung;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\nimport org.junit.jupiter.api.Disabled;\r\nimport org.junit.jupiter.api.Tag;\r\n\r\n\/**\r\n * Annotation f\u00fcr Performance Tests. Zentral ausgeschaltet.\r\n * \r\n * @author Thomas Wenzlaff  www.kleinhirn.eu\r\n *\/\r\n@Disabled\r\n@Target({ ElementType.TYPE, ElementType.METHOD })\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Tag(\"Performance\")\r\npublic @interface Performance {\r\n}<\/pre>\n<p>In diesem Testlauf, habe ich mit der Annotation, die lange laufenden Test ausgeschaltet:<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2017\/10\/junit-5-annotation.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2017\/10\/junit-5-annotation.png\" alt=\"\" width=\"1022\" height=\"528\" class=\"aligncenter size-full wp-image-9044\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2017\/10\/junit-5-annotation.png 1022w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2017\/10\/junit-5-annotation-300x155.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2017\/10\/junit-5-annotation-768x397.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Wof\u00fcr nutzt ihr die Custom Composed Annotation? Gern als Kommentar&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wenn man an einer zentralen Stelle Testmethoden annotieren will, geht das mit JUnit 5 \u00fcber eigene Benutzer Annotationen. Ich habe mir eine Annotation f\u00fcr Performance Test geschrieben. Z.B. kann ich sie dann zentral ausschalten: package de.wenzlaff.umgebung; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; \/** * Annotation f\u00fcr Performance Tests. Zentral &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/blog.wenzlaff.de\/?p=9043\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eWie k\u00f6nnen mit JUnit 5 Custom Composed Annotation erstellt werden?\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,2953,79,2658],"tags":[106,3036,3037,2943,3038],"class_list":["post-9043","post","type-post","status-publish","format-standard","hentry","category-eclipse","category-junit-5","category-programmierung","category-test-thema","tag-annotationen","tag-benutzer-annotationen","tag-custom-composed-annotation","tag-junit-5","tag-performance"],"_links":{"self":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/9043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9043"}],"version-history":[{"count":0,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/9043\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9043"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}