{"id":222,"date":"2005-10-21T08:25:04","date_gmt":"2005-10-21T07:25:04","guid":{"rendered":"http:\/\/thekua.com\/rant\/?p=222"},"modified":"2005-10-21T08:52:21","modified_gmt":"2005-10-21T07:52:21","slug":"more-readable-test-names","status":"publish","type":"post","link":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/","title":{"rendered":"More Readable Test Names"},"content":{"rendered":"<p>We put in a JUnit hack into our latest project that allows us to produce more readable test names.<\/p>\n<blockquote><p><code>@Override public String getName()  {<br \/>\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return getClass().getSimpleName().replaceAll(\"Test$\", \"\")<br \/>\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ super.getName().substring(4).replaceAll(\"([A-Z])\", \" $1\").toLowerCase();<br \/>\n}<\/code><\/p><\/blockquote>\n<p>Turning <strong><code>testTellsMeHowMuchInterestIEarnInAYear()<\/code><\/strong> from the <strong><code>BankManagerTest<\/code><\/strong> into <strong><code>Bank Manager tells me how much interest i earn in a year.<\/code><\/strong>.<\/p>\n<p>Note the disclaimer:  Tests in IntelliJ are no longer clickable afterwards but the stack traces still are<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We put in a JUnit hack into our latest project that allows us to produce more readable test names. @Override public String getName() { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return getClass().getSimpleName().replaceAll(&#8220;Test$&#8221;, &#8220;&#8221;) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ super.getName().substring(4).replaceAll(&#8220;([A-Z])&#8221;, &#8221; $1&#8243;).toLowerCase(); } Turning testTellsMeHowMuchInterestIEarnInAYear() from the BankManagerTest into Bank Manager tells me how much interest i earn in a year.. Note the disclaimer: Tests in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[39],"class_list":["post-222","post","type-post","status-publish","format-standard","hentry","category-technical","tag-work-related"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>More Readable Test Names - thekua.com@rest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"More Readable Test Names - thekua.com@rest\" \/>\n<meta property=\"og:description\" content=\"We put in a JUnit hack into our latest project that allows us to produce more readable test names. @Override public String getName() { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return getClass().getSimpleName().replaceAll(&quot;Test$&quot;, &quot;&quot;) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ super.getName().substring(4).replaceAll(&quot;([A-Z])&quot;, &quot; $1&quot;).toLowerCase(); } Turning testTellsMeHowMuchInterestIEarnInAYear() from the BankManagerTest into Bank Manager tells me how much interest i earn in a year.. Note the disclaimer: Tests in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/\" \/>\n<meta property=\"og:site_name\" content=\"thekua.com@rest\" \/>\n<meta property=\"article:published_time\" content=\"2005-10-21T07:25:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2005-10-21T07:52:21+00:00\" \/>\n<meta name=\"author\" content=\"Patrick\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#\\\/schema\\\/person\\\/6de103b28f96be3f1f4dc25db357c6ae\"},\"headline\":\"More Readable Test Names\",\"datePublished\":\"2005-10-21T07:25:04+00:00\",\"dateModified\":\"2005-10-21T07:52:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/\"},\"wordCount\":44,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#\\\/schema\\\/person\\\/6de103b28f96be3f1f4dc25db357c6ae\"},\"keywords\":[\"Work-Related\"],\"articleSection\":[\"Work Related\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/\",\"name\":\"More Readable Test Names - thekua.com@rest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#website\"},\"datePublished\":\"2005-10-21T07:25:04+00:00\",\"dateModified\":\"2005-10-21T07:52:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/2005\\\/10\\\/more-readable-test-names\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/rant\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"More Readable Test Names\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#website\",\"url\":\"https:\\\/\\\/thekua.com\\\/rant\\\/\",\"name\":\"thekua.com@rest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#\\\/schema\\\/person\\\/6de103b28f96be3f1f4dc25db357c6ae\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thekua.com\\\/rant\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/#\\\/schema\\\/person\\\/6de103b28f96be3f1f4dc25db357c6ae\",\"name\":\"Patrick\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/pat-kua-head.png\",\"url\":\"https:\\\/\\\/thekua.com\\\/rant\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/pat-kua-head.png\",\"contentUrl\":\"https:\\\/\\\/thekua.com\\\/rant\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/pat-kua-head.png\",\"width\":400,\"height\":400,\"caption\":\"Patrick\"},\"logo\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/rant\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/pat-kua-head.png\"},\"sameAs\":[\"http:\\\/\\\/www.thekua.com\"],\"url\":\"https:\\\/\\\/thekua.com\\\/rant\\\/author\\\/patrick\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"More Readable Test Names - thekua.com@rest","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:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/","og_locale":"en_US","og_type":"article","og_title":"More Readable Test Names - thekua.com@rest","og_description":"We put in a JUnit hack into our latest project that allows us to produce more readable test names. @Override public String getName() { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return getClass().getSimpleName().replaceAll(\"Test$\", \"\") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ super.getName().substring(4).replaceAll(\"([A-Z])\", \" $1\").toLowerCase(); } Turning testTellsMeHowMuchInterestIEarnInAYear() from the BankManagerTest into Bank Manager tells me how much interest i earn in a year.. Note the disclaimer: Tests in [&hellip;]","og_url":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/","og_site_name":"thekua.com@rest","article_published_time":"2005-10-21T07:25:04+00:00","article_modified_time":"2005-10-21T07:52:21+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Patrick"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/rant\/#\/schema\/person\/6de103b28f96be3f1f4dc25db357c6ae"},"headline":"More Readable Test Names","datePublished":"2005-10-21T07:25:04+00:00","dateModified":"2005-10-21T07:52:21+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/"},"wordCount":44,"commentCount":3,"publisher":{"@id":"https:\/\/thekua.com\/rant\/#\/schema\/person\/6de103b28f96be3f1f4dc25db357c6ae"},"keywords":["Work-Related"],"articleSection":["Work Related"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/","url":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/","name":"More Readable Test Names - thekua.com@rest","isPartOf":{"@id":"https:\/\/thekua.com\/rant\/#website"},"datePublished":"2005-10-21T07:25:04+00:00","dateModified":"2005-10-21T07:52:21+00:00","breadcrumb":{"@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/rant\/2005\/10\/more-readable-test-names\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/rant\/"},{"@type":"ListItem","position":2,"name":"More Readable Test Names"}]},{"@type":"WebSite","@id":"https:\/\/thekua.com\/rant\/#website","url":"https:\/\/thekua.com\/rant\/","name":"thekua.com@rest","description":"","publisher":{"@id":"https:\/\/thekua.com\/rant\/#\/schema\/person\/6de103b28f96be3f1f4dc25db357c6ae"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thekua.com\/rant\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/thekua.com\/rant\/#\/schema\/person\/6de103b28f96be3f1f4dc25db357c6ae","name":"Patrick","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/thekua.com\/rant\/wp-content\/uploads\/2025\/12\/pat-kua-head.png","url":"https:\/\/thekua.com\/rant\/wp-content\/uploads\/2025\/12\/pat-kua-head.png","contentUrl":"https:\/\/thekua.com\/rant\/wp-content\/uploads\/2025\/12\/pat-kua-head.png","width":400,"height":400,"caption":"Patrick"},"logo":{"@id":"https:\/\/thekua.com\/rant\/wp-content\/uploads\/2025\/12\/pat-kua-head.png"},"sameAs":["http:\/\/www.thekua.com"],"url":"https:\/\/thekua.com\/rant\/author\/patrick\/"}]}},"_links":{"self":[{"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":0,"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/rant\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}