FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-spring-app/src/test/java/application/EndpointTest.java at master · IBM/java-spring-app · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Feb 15, 2023. It is now read-only.
IBM
/
java-spring-app
Public archive
Notifications
You must be signed in to change notification settings
Fork
34
Star
11
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-spring-app
/
src
/
test
/
java
/
application
/
EndpointTest.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
34 lines (28 loc) · 1.22 KB
Breadcrumbs
java-spring-app
/
src
/
test
/
java
/
application
/
EndpointTest.java
Copy path
File metadata and controls
executable file
·
34 lines (28 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package
application
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
org
.
junit
.
jupiter
.
api
.
Test
;
import
org
.
junit
.
jupiter
.
api
.
extension
.
ExtendWith
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
boot
.
test
.
context
.
SpringBootTest
;
import
org
.
springframework
.
boot
.
test
.
context
.
SpringBootTest
.
WebEnvironment
;
import
org
.
springframework
.
boot
.
test
.
web
.
client
.
TestRestTemplate
;
import
org
.
springframework
.
boot
.
test
.
web
.
server
.
LocalServerPort
;
import
org
.
springframework
.
http
.
HttpStatus
;
import
org
.
springframework
.
http
.
HttpStatusCode
;
import
org
.
springframework
.
http
.
ResponseEntity
;
import
org
.
springframework
.
test
.
context
.
junit
.
jupiter
.
SpringExtension
;
@
ExtendWith
(
SpringExtension
.
class
)
@
SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
public
class
EndpointTest
{
@
Autowired
private
TestRestTemplate
server
;
@
LocalServerPort
private
int
port
;
@
Test
public
void
testEndpoint
()
throws
Exception
{
String
endpoint
=
"http://localhost:"
+
port
;
ResponseEntity
<
String
>
response
=
server
.
getForEntity
(
endpoint
,
String
.
class
);
HttpStatusCode
status
=
response
.
getStatusCode
();
assertEquals
(
HttpStatus
.
OK
,
status
,
"Invalid response from server : "
+
response
);
}
}
Back
|
FazBrowse Home
|
New Git URL