Skip to content

Commit 2ef2017

Browse files
committed
updated docs
1 parent 64439e0 commit 2ef2017

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VSCode Java Tests
22

3-
Extension to help develop Java tests.
3+
Extension to help write Java tests.
44

55
## How to Use
66

@@ -12,7 +12,54 @@ Extension to help develop Java tests.
1212

1313
### Create Test File
1414

15-
Generate a test class with code to construct the source class, if already there is a test class then it will be open.
15+
Generate a test class in the folder `src/test/java` with code to construct the source class, if already there is a test class then it will be open.
16+
17+
Example:
18+
19+
Given the file `/src/main/java/com/github/sample/MessageService.java`:
20+
21+
```java
22+
package com.github.sample;
23+
24+
import org.slf4j.Logger;
25+
import org.slf4j.LoggerFactory;
26+
27+
public class MessageService {
28+
public String getMessage() {
29+
return "Hello World!";
30+
}
31+
}
32+
```
33+
34+
Generate the test file `/src/test/java/com/github/sample/MessageServiceTest.java`:
35+
36+
```java
37+
package com.github.sample;
38+
39+
import static org.hamcrest.CoreMatchers.*;
40+
import org.hamcrest.CustomMatcher;
41+
import org.hamcrest.Matcher;
42+
import static org.junit.Assert.assertThat;
43+
import org.junit.Before;
44+
import org.junit.Test;
45+
46+
import com.github.sample.MessageService;
47+
48+
public class MessageServiceTest {
49+
private MessageService cut;
50+
51+
@Before
52+
public void setup() {
53+
this.cut = new MessageService();
54+
}
55+
56+
@Test
57+
public void shouldCompile() {
58+
assertThat("Actual value", is("Expected value"));
59+
}
60+
}
61+
62+
```
1663

1764
## Todos
1865

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-java-tests",
33
"publisher": "wesleyegberto",
44
"displayName": "vscode-java-tests",
5-
"description": "Extension to write develop Java tests",
5+
"description": "Extension to help write Java tests",
66
"version": "0.0.1",
77
"engines": {
88
"vscode": "^1.47.0"

0 commit comments

Comments
 (0)