JUnit 4.7 introduces the concept of custom rules:
http://www.infoq.com/news/2009/07/junit-4.7-rules
There are a number of built-in JUnit rules, including TemporaryFolder, which help by cleaning folders after running the test:
@Rule public TemporaryFolder tempFolder = new TemporaryFolder();
Here is a complete list of built-in rules:
http://kentbeck.github.com/junit/javadoc/latest/org/junit/rules/package-summary.html
I am interested to know what user rules exist where you work, or what useful user rules you are currently using?
I used @Rule to retest: @ Rule: ε¨ JUnit4 δΈ ε©η¨ Rule
Sorry, this is Chinese, but the code and comment are in English :)
Source: https://habr.com/ru/post/1744254/More articles:FluentNHibernate: multiple one-to-many relationships between the same objects - .netUsing Joins vs Entity Associations - .netScala Eclipse IDE suddenly ignores breakpoints - debuggingC # equivalent of typeof for fields - reflectionHow to set itemsource? - visual-studio-2010Recommendations for updating the build server - linuxPerformance Considerations When Mixing C ++ and Objective-C in a Single File - c ++How to create a view for managing associations between HABTM models? (Rails) - ruby-on-railshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1744258/alternatives-to-linq-to-sql-on-high-loaded-pages&usg=ALkJrhjW5SRN2u-tduBYo-xGwUj3y0-nVwHow to get my program to register a user in Windows? - c ++All Articles