jkube icon indicating copy to clipboard operation
jkube copied to clipboard

(jkube-kit-generator-webapp): Replace JUnit4 with JUnit5

Open manusa opened this issue 3 years ago • 3 comments

Component

jkube-kit-generator-webapp

Task description

Child of #1546

  • Remove JUnit4 dependencies
  • Add JUnit5 dependencies
  • Refactor tests

manusa avatar Jun 14 '22 11:06 manusa

@rohanKanojia please assign this to me

anurag-rajawat avatar Aug 03 '22 06:08 anurag-rajawat

@manusa I rewrite these assertions https://github.com/eclipse/jkube/blob/cccc2864555f9e0959020d4c4fe4e817d587f865/jkube-kit/generator/webapp/src/test/java/org/eclipse/jkube/generator/webapp/handler/JettyAppSeverHandlerTest.java#L48-L49

like

    assertThat(Files.createDirectory(temporaryFolder.toPath().resolve("META-INF")))
        .satisfies(p -> assertThat(new File(p.toFile(), "jetty-logging.properties").createNewFile()).isTrue());
    assertThat(Files.createDirectory(temporaryFolder.toPath().resolve("META-INF-1337")))
        .satisfies(p -> assertThat(new File(p.toFile(), "context.xml").createNewFile()).isTrue());

please tell me a better way to assert these.

anurag-rajawat avatar Aug 03 '22 08:08 anurag-rajawat

Those assertions were there to remove code smells. There's no need to assert these with the Files.xxx methods since these will fail in case they don't complete successfully.

If you see any assertion in the Given test block, they should only serve for this purpose, else there might be something wrong in the test implementation

manusa avatar Aug 03 '22 09:08 manusa