[Personal] JUnit5 memorandum memo (work in progress)

I often forget the processes that are often used in JUnit 5, so I will write them as a memorandum.

What you can do with standard functions. I can't do it, so make a note of the case where you need to make your own.

1. What you want to do

1-1. Preparation

1-2. Test verification

1-3. Post-processing

1-4. Others

2. Basic knowledge

2-1. Basic knowledge

2-2. Reference URL

3.TIPS

3-1. File lock

Lock the target file so that it cannot be read.


    try (
        FileChannel fc =
            FileChannel.open(Paths.get(""), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
        FileLock lock = fc.tryLock()) {
      //Operation after lock acquisition
    } catch (Exception e) {
      //Lock acquisition failure
    }

3-2. File comparison

If the file size is small, use commons-io for the following.

    assertThat(FileUtils.readFileToString(file1, "UTF-8"),
        is(FileUtils.readFileToString(file2, "UTF-8")));

3-3. Specify VM argument

Recommended Posts

[Personal] JUnit5 memorandum memo (work in progress)
JUnit memorandum
Display message dialog in java (personal memo)
Refactoring in JUnit
JUnit5 usage memo
[Personal application work memo] How to display a bar graph and a line graph in one graph
[Personal memo] Make a simple deep copy in Java
[Personal application work memo] Make a calendar with simple_calendar
Personal summary of the guys often used in JUnit 4
[Personal memo] try-catch summary
Docker Machine (personal memorandum)
webApi memorandum in java
Docker network (personal memorandum)
[Personal application work memo] Move the location of the follow button