diff --git a/.checkstyle/checkstyle.xml b/.checkstyle/checkstyle.xml index 6965c26..874430e 100644 --- a/.checkstyle/checkstyle.xml +++ b/.checkstyle/checkstyle.xml @@ -82,7 +82,13 @@ - + + + + + + + diff --git a/dummy-module/src/test/java/io/skodjob/DummyTest.java b/dummy-module/src/test/java/io/skodjob/DummyTest.java index 12ce6f3..03c18e4 100644 --- a/dummy-module/src/test/java/io/skodjob/DummyTest.java +++ b/dummy-module/src/test/java/io/skodjob/DummyTest.java @@ -45,7 +45,7 @@ void testMethodOne() { @TestDoc( description = @Desc("Test checking that the application works as expected. " + - "This is just a little bit longer line, nothing else."), + "This is just a little bit longer line, nothing else."), contact = @Contact(name = "Jakub Stejskal", email = "ja@kub.io"), steps = { @Step(value = "Create object instance", expected = "Instance of an object is created"), @@ -60,7 +60,7 @@ void testMethodTwo() { @TestDoc( description = @Desc("Test checking that the application works as expected. " + - "This is just a little bit longer line, nothing else."), + "This is just a little bit longer line, nothing else."), contact = @Contact(name = "Jakub Stejskal", email = "ja@kub.io") ) void testMethodThree() { @@ -69,7 +69,7 @@ void testMethodThree() { @TestDoc( description = @Desc("Test checking that the application works as expected. " + - "This is just a little bit longer line, nothing else."), + "This is just a little bit longer line, nothing else."), contact = @Contact(name = "Jakub Stejskal", email = "ja@kub.io"), labels = { @Label(value = "default"), diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/DocGeneratorMojo.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/DocGeneratorMojo.java index 865b871..10c93e1 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/DocGeneratorMojo.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/DocGeneratorMojo.java @@ -25,9 +25,9 @@ * DocGeneratorMojo class for Maven plugin handling */ @Mojo( - name = "test-docs-generator", - defaultPhase = LifecyclePhase.COMPILE, - requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME + name = "test-docs-generator", + defaultPhase = LifecyclePhase.COMPILE, + requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME ) public class DocGeneratorMojo extends AbstractMojo { @@ -79,10 +79,10 @@ public DocGeneratorMojo() { /** * Method for the execution of the test-docs-generator Maven plugin * Generates documentation of test-cases based on specified parameters: - * - {@link #testsPath} - * - {@link #docsPath} - * - {@link #project} - * - {@link #descriptor} + *
  • {@link #testsPath}
  • + *
  • {@link #docsPath}
  • + *
  • {@link #project}
  • + *
  • {@link #descriptor}
*/ public void execute() { @@ -100,7 +100,7 @@ public void execute() { // Add all jar files in target lib addJarFilesToClassPath(new File(project.getBuild().getDirectory()), classRealm); } catch (MalformedURLException e) { - e.printStackTrace(); + getLog().error(e); } getLog().debug("Loaded files in classpath:"); @@ -121,7 +121,7 @@ public void execute() { } else { getLog().debug("Skipping fmf generation"); } - MdGenerator.generate(testClass, docsPath + mdDirectoryName + entry.getKey() + ".md"); + MdGenerator.generate(testClass, docsPath + mdDirectoryName + entry.getKey() + ".md"); } catch (ClassNotFoundException | IOException ex) { getLog().warn(String.format("Cannot load %s", entry.getValue())); @@ -136,9 +136,10 @@ public void execute() { /** * It goes through all files inside the {@param directory} and does two things: - * - in case that file is directory (another package), it recursively calls itself and adds all .jar files to the classPath - * - otherwise adds the .jar files to classPath - * @param directory where the files are listed + *
  • in case that file is directory (another package), it recursively calls itself and adds all .jar files to the classPath
  • + *
  • otherwise adds the .jar files to classPath
+ * + * @param directory where the files are listed * @param classRealm realm containing all libs set on classPath, from where the test-classes will be loaded * @throws MalformedURLException during URL construction */ diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/FmfGenerator.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/FmfGenerator.java index 3caba60..7a4b930 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/FmfGenerator.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/FmfGenerator.java @@ -43,7 +43,7 @@ private FmfGenerator() { * parent folders (if needed), new FMF file for the class, and after that generates test-suite documentation using * {@link #generateDocumentationForTestCases(PrintWriter, List)}, all written inside the newly created Markdown file. * - * @param testClass for which the FMF file is created and test-cases are documented + * @param testClass for which the FMF file is created and test-cases are documented * @param classFilePath path of the FMF file * @throws IOException during file creation */ @@ -63,7 +63,8 @@ public static void generate(Class testClass, String classFilePath) throws IOE /** * Generates documentation records for each test-cases (test-methods) from {@param methods} - * @param writer file writer + * + * @param writer file writer * @param methods containing {@link TestDoc} annotation */ private static void generateDocumentationForTestCases(PrintWriter writer, List methods) { @@ -82,8 +83,8 @@ private static void generateDocumentationForTestCases(PrintWriter writer, List> createListOfSteps(Step[] steps) { /** * Creates list of labels for the particular test-case + * * @param labels list of labels from the {@link TestDoc} annotation * @return list of labels in {@link List} */ diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/MdGenerator.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/MdGenerator.java index ec9b23f..7bc624f 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/MdGenerator.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/MdGenerator.java @@ -196,9 +196,9 @@ public static void createSuiteRecord(PrintWriter write, SuiteDoc suiteDoc) { /** * For the provided list of steps creates table with following columns: - * - Step - number of the current step - * - Action - action done during the step - * - Result - expected result of the step + *
    Step - number of the current step + *
  • Action - action done during the step
  • + *
  • Result - expected result of the step
* * @param steps list of steps of the test-case * @return String representation of table in Markdown @@ -231,7 +231,7 @@ private static List createLabels(Label[] labels) { * Update label file that is available in the docs dir * * @param labelFilePath path to label file within docs dir - * @param updatedData data that will be put into the file + * @param updatedData data that will be put into the file */ private static void updateLabelFile(String labelFilePath, String updatedData) { try { diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Contact.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Contact.java index 1cdae04..488d51b 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Contact.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Contact.java @@ -14,12 +14,14 @@ public @interface Contact { /** * Contact name of the test-case stored inside `name` field + * * @return name in String */ String name(); /** * Contact email of the test-case stored inside `email` field + * * @return email in String */ String email(); diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Desc.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Desc.java index a3764e5..150af79 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Desc.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Desc.java @@ -14,6 +14,7 @@ public @interface Desc { /** * Description of the test-case stored inside `value` field + * * @return description in String */ String value(); diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Label.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Label.java index f32ffa5..dfde88c 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Label.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Label.java @@ -14,6 +14,7 @@ public @interface Label { /** * Label of the test-case stored inside `value` field + * * @return label in String */ String value() default ""; diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Step.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Step.java index fe39dea..e6b893c 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Step.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/Step.java @@ -14,12 +14,14 @@ public @interface Step { /** * Step of the test-case stored inside `value` field + * * @return step in String */ String value() default ""; /** * Expected outcome of the particular step in test-case + * * @return expected outcome in String */ String expected() default ""; diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/SuiteDoc.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/SuiteDoc.java index 39f3553..7aba2a7 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/SuiteDoc.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/SuiteDoc.java @@ -9,60 +9,41 @@ /** * Annotation collecting all information about the test-suite. - * Currently, we can specify following: - * - description - * - beforeTestSteps - * - afterTestSteps - * - labels - * - * Example usage: - * ``` - * \@SuiteDoc( - * description = @Desc("My test suite containing various tests"), - * beforeTestSteps = { - * \@Step(value = "Deploy uber operator across all namespaces, with custom configuration", expected = "Uber operator is deployed"), - * \@Step(value = "Deploy management Pod for accessing all other Pods", expected = "Management Pod is deployed") - * }, - * afterTestSteps = { - * \@Step(value = "Delete management Pod", expected = "Management Pod is deleted"), - * \@Step(value = "Delete uber operator", expected = "Uber operator is deleted") - * }, - * labels = { - * \@Label(value = "regression") - * } - * ) - * public static class TestClass { - * ``` */ @Retention(RetentionPolicy.RUNTIME) public @interface SuiteDoc { /** * Description of particular test-suite + * * @return description in {@link Desc} */ Desc description(); /** * Contact name of particular test-case + * * @return contact name in {@link Contact} */ Contact contact() default @Contact(name = "", email = ""); /** * Array of steps done before tests execution + * * @return array of steps in {@link Step} */ Step[] beforeTestSteps() default {}; /** * Array of steps done after tests execution + * * @return array of steps in {@link Step} */ Step[] afterTestSteps() default {}; /** * Array of labels describing the test-case + * * @return array of labels in {@link Label} */ Label[] labels() default {}; diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/TestDoc.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/TestDoc.java index be6b81e..9bb1305 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/TestDoc.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/annotations/TestDoc.java @@ -36,24 +36,28 @@ /** * Description of particular test-case + * * @return description in {@link Desc} */ Desc description(); /** * Contact name of particular test-case + * * @return contact name in {@link Contact} */ Contact contact() default @Contact(name = "", email = ""); /** * Array of steps done in the test-case + * * @return array of steps in {@link Step} */ Step[] steps() default {}; /** * Array of labels describing the test-case + * * @return array of labels in {@link Label} */ Label[] labels() default {}; diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/common/Utils.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/common/Utils.java index b668ba6..30683bb 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/common/Utils.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/common/Utils.java @@ -33,14 +33,14 @@ private Utils() { /** * Updates Map ({@param classes}) with info about classes inside {@param packagePath}. * It goes through all files inside the {@param packagePath} and does two things: - * - in case that file is directory (another package), it recursively calls itself and adds all info needed for all files - * inside the directory - * - otherwise adds key/value record in the map - * - key -> path in which the particular `.md` file will be generated, typically {@param generatePath}/{@code classPackagePath} - * - f.e. -> ./test-docs/path/to/my/package/TestClassST - * - value -> path for the particular test class -> in package format, available on classpath - * - f.e. -> path.to.my.package.TestClassST - * @param classes Map that should be updated with test-classes info + *
  • in case that file is directory (another package), it recursively calls itself and adds all info needed for all files inside the directory
  • + *
  • otherwise adds key/value record in the map + *
    • key -> path in which the particular `.md` file will be generated, typically {@param generatePath}/{@code classPackagePath} + *
      • f.e. -> ./test-docs/path/to/my/package/TestClassST
      • + *
      • value -> path for the particular test class -> in package format, available on classpath
      • + *
      • f.e. -> path.to.my.package.TestClassST
+ * + * @param classes Map that should be updated with test-classes info * @param packagePath path on which the files and classes should be listed * @return updated Map with test-classes info from the {@param packagePath} */ @@ -69,7 +69,8 @@ private static Map getClassesForPackage(Map clas * path, where the Markdown file will be created, and value is package with class name available * on classpath * Also excludes files that should not be considered for documentation (currently just "AbstractST") - * @param filePath path where are all test-classes present + * + * @param filePath path where are all test-classes present * @param generateDirs whether it should generate subfolders for packages or not * @return Map with test-classes info from the {@param filePath} */ @@ -87,6 +88,7 @@ public static Map getTestClassesWithTheirPath(String filePath, b /** * Creates needed files and folders for the particular test-suite (test-class) + * * @param classFilePath path where the test-suite (test-class) is present * @return file writer * @throws IOException during file creation diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Header.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Header.java index 836917a..feb032d 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Header.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Header.java @@ -18,6 +18,7 @@ private Header() { /** * Method for creating first level header containing {@param text} + * * @param text that should be in first level header * @return first level header with {@param text} */ @@ -27,6 +28,7 @@ public static String firstLevelHeader(String text) { /** * Method for creating second level header containing {@param text} + * * @param text that should be in second level header * @return second level header with {@param text} */ diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Line.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Line.java index 979bc3c..c9a84ae 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Line.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Line.java @@ -18,6 +18,7 @@ private Line() { /** * Creates horizontal line + * * @return horizontal line in String */ public static String horizontalLine() { diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Table.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Table.java index 57fb69c..68744d3 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Table.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/Table.java @@ -20,8 +20,9 @@ private Table() { /** * Creates the Markdown table in text format, containing specified headers and rows + * * @param headers list of headers that should be inside the table - * @param rows list of rows added to the table + * @param rows list of rows added to the table * @return Markdown table in text format, returned as String */ public static String createTable(List headers, List rows) { @@ -44,6 +45,7 @@ public static String createTable(List headers, List rows) { /** * Creates a single row for {@param content} + * * @param content of the row * @return table row in text format, returned as String */ diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextList.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextList.java index 5616f99..7563eb0 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextList.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextList.java @@ -20,13 +20,14 @@ private TextList() { /** * Creates the Markdown unordered list in text format, containing all from the {@param objects} + * * @param objects list of objects that should be inside the unordered list * @return Markdown unordered list in text format, returned as String */ public static String createUnorderedList(List objects) { StringBuilder builder = new StringBuilder(); objects.forEach(object -> - builder.append("* " + object + "\n") + builder.append("* ").append(object).append("\n") ); return builder.toString(); diff --git a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextStyle.java b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextStyle.java index 0fb37f3..5d09872 100644 --- a/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextStyle.java +++ b/test-docs-generator-maven-plugin/src/main/java/io/skodjob/markdown/TextStyle.java @@ -18,6 +18,7 @@ private TextStyle() { /** * Method for adding bold style to specified {@param text} + * * @param text that should be in bold style * @return bold stylization for {@param text} */