Skip to content

Feature Request: Custom Test Template #4

Description

@baincd

I think it would be a nice feature to be able to configure a custom test template. For example, the custom template configuration could look something like

"javaTests.customTemplate": [
  "package {PackageName};",
  "",
  "import static org.assertj.core.api.Assertions.assertThat;",
  "",
  "import org.junit.jupiter.api.Test;",
  "",
  "public class {ClassUnderTest}Test {",
  "",
  "	private {ClassUnderTest} classUnderTest;",
  "",
  "	@BeforeEach",
  "	public void setup() {",
  "		classUnderTest = new {ClassUnderTest}(serviceProperties);",
  "	}",
  "",
  "	@Test",
  "	public void testSomething() {",
  "		assertThat(2+2).isEqualTo(5);",
  "	}",
  "}",
]

There would need to be some placeholders that would be replaced, such as

  • {PackageName}
  • {ClassUnderTest}
  • {ClassUnderTestAsVarName} (the class under test name, but with the first letter lower case).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions