Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EmployeeManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pragatha Bairava Ramachandran
EmployeeManagement
Commits
febf6477
Commit
febf6477
authored
Dec 19, 2019
by
Pragatha Bairava Ramachandran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
included rest assured get test
parent
8c2f669e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
5 deletions
+45
-5
pom.xml
EmployeeManagement/pom.xml
+12
-0
EmployeeController.java
...yee/EmployeeManagement/Controller/EmployeeController.java
+10
-0
EmployeeManagementApplicationTests.java
...mployeeManagement/EmployeeManagementApplicationTests.java
+23
-5
No files found.
EmployeeManagement/pom.xml
View file @
febf6477
...
@@ -67,6 +67,18 @@
...
@@ -67,6 +67,18 @@
<artifactId>
reactor-test
</artifactId>
<artifactId>
reactor-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
io.rest-assured
</groupId>
<artifactId>
rest-assured
</artifactId>
<version>
3.1.0
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.14.3
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
EmployeeManagement/src/main/java/com/employee/EmployeeManagement/Controller/EmployeeController.java
View file @
febf6477
...
@@ -27,6 +27,16 @@ public class EmployeeController {
...
@@ -27,6 +27,16 @@ public class EmployeeController {
model
.
addAttribute
(
"employees"
,
empList
);
model
.
addAttribute
(
"employees"
,
empList
);
return
"home"
;
return
"home"
;
}
}
@GetMapping
(
"/allemployees"
)
@ResponseBody
public
List
<
Employee
>
getEmployees
()
{
List
<
Employee
>
empList
=
employeeRepository
.
findAll
();
for
(
int
i
=
0
;
i
<
empList
.
size
();
i
++)
{
System
.
out
.
println
(
empList
.
get
(
i
));
}
return
empList
;
}
@GetMapping
(
"/new"
)
@GetMapping
(
"/new"
)
public
String
homeEmployee
(
Model
model
)
public
String
homeEmployee
(
Model
model
)
...
...
EmployeeManagement/src/test/java/com/employee/EmployeeManagement/EmployeeManagementApplicationTests.java
View file @
febf6477
package
com
.
employee
.
EmployeeManagement
;
package
com
.
employee
.
EmployeeManagement
;
import
org.junit.jupiter.api.Test
;
import
static
io
.
restassured
.
RestAssured
.
delete
;
import
static
io
.
restassured
.
RestAssured
.
get
;
import
static
io
.
restassured
.
RestAssured
.
given
;
import
static
org
.
hamcrest
.
Matchers
.
hasItems
;
import
org.hamcrest.Matchers
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
io.restassured.http.ContentType
;
import
io.restassured.response.Response
;
@SpringBootTest
@SpringBootTest
class
EmployeeManagementApplicationTests
{
public
class
EmployeeManagementApplicationTests
{
final
static
String
ROOT_URI
=
"http://localhost:8080"
;
@Test
@Test
void
contextLoads
()
{
public
void
simple_get_test
()
{
}
Response
response
=
get
(
ROOT_URI
+
"/allemployees"
);
System
.
out
.
println
(
response
.
asString
());
response
.
then
().
body
(
"empId"
,
hasItems
(
1
));
response
.
then
().
body
(
"empFirstName"
,
hasItems
(
"aaa"
));
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment