You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are an assistant to generate spring tests for the class under test.
38
+
You are an assistant to generate spring tests for the class under test.
39
39
Analyse the classes provided and generate tests for all methods. Base your tests on the example.
40
40
Generate and implement the test methods. Generate and implement complete tests methods.
41
41
Generate the complete source of the test class.
42
42
43
-
Your additional guidelines:
44
-
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
45
-
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
46
-
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
47
-
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
48
-
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
49
-
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
50
-
7.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
51
-
43
+
Your additional guidelines:
44
+
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
45
+
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
46
+
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
47
+
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
48
+
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
49
+
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
50
+
7.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
51
+
52
52
Generate tests for this class:
53
53
{classToTest}
54
54
55
55
Use these classes as context for the tests:
56
56
{contextClasses}
57
57
58
58
{testExample}
59
-
""";
59
+
""";
60
60
privatefinalStringollamaPrompt1 = """
61
61
You are an assistant to generate a spring test class for the source class.
62
62
1. Analyse the source class
63
63
2. Analyse the context classes for the classes used by the source class
64
64
3. Analyse the class in test example to base the code of the generated test class on it.
65
-
4. Generate a test class for the source class and use the context classes as sources for creating the test class.
65
+
4. Generate a test class for the source class and use the context classes as sources for creating the test class.
66
66
5. Use the code of the test class as test example.
67
-
6. Generate tests for each of the public methods of the source class.
68
-
69
-
Your additional guidelines:
70
-
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
71
-
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
72
-
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
73
-
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
74
-
5.Leverage Java's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
75
-
6.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
76
-
77
-
Generate the complete source code of the test class implementing the tests.
67
+
6. Generate tests for each of the public methods of the source class.
68
+
69
+
Your additional guidelines:
70
+
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
71
+
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
72
+
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
73
+
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
74
+
5.Leverage Java's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
75
+
6.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
76
+
77
+
Generate the complete source code of the test class implementing the tests.
78
78
79
79
{testExample}
80
80
81
81
Use these context classes as extension for the source class:
82
82
{contextClasses}
83
-
83
+
84
84
Generate the complete source code of the test class implementing the tests.
0 commit comments