Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
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
openSource
spring-boot-admin
Commits
4bc9d3a9
Commit
4bc9d3a9
authored
Jan 08, 2017
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation errors in tests
parent
df8b1e43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
ApplicationTest.java
...java/de/codecentric/boot/admin/model/ApplicationTest.java
+6
-7
RegistryControllerTest.java
...ntric/boot/admin/registry/web/RegistryControllerTest.java
+15
-5
No files found.
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/model/ApplicationTest.java
View file @
4bc9d3a9
...
...
@@ -6,7 +6,6 @@ import static org.hamcrest.Matchers.not;
import
static
org
.
hamcrest
.
Matchers
.
nullValue
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
java.io.IOException
;
import
java.util.Collections
;
import
org.json.JSONObject
;
...
...
@@ -20,7 +19,7 @@ public class ApplicationTest {
private
ObjectMapper
objectMapper
=
Jackson2ObjectMapperBuilder
.
json
().
build
();
@Test
public
void
test_1_2_json_format
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_1_2_json_format
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
"test"
).
put
(
"url"
,
"http://test"
).
toString
();
Application
value
=
objectMapper
.
readValue
(
json
,
Application
.
class
);
assertThat
(
value
.
getName
(),
is
(
"test"
));
...
...
@@ -30,7 +29,7 @@ public class ApplicationTest {
}
@Test
public
void
test_1_4_json_format
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_1_4_json_format
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
"test"
).
put
(
"managementUrl"
,
"http://test"
)
.
put
(
"healthUrl"
,
"http://health"
).
put
(
"serviceUrl"
,
"http://service"
)
.
put
(
"statusInfo"
,
new
JSONObject
().
put
(
"status"
,
"UNKNOWN"
)).
toString
();
...
...
@@ -42,7 +41,7 @@ public class ApplicationTest {
}
@Test
public
void
test_1_5_json_format
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_1_5_json_format
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
"test"
).
put
(
"managementUrl"
,
"http://test"
)
.
put
(
"healthUrl"
,
"http://health"
).
put
(
"serviceUrl"
,
"http://service"
)
.
put
(
"metadata"
,
new
JSONObject
().
put
(
"labels"
,
"foo,bar"
)).
toString
();
...
...
@@ -55,7 +54,7 @@ public class ApplicationTest {
}
@Test
public
void
test_onlyHealthUrl
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_onlyHealthUrl
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
"test"
).
put
(
"healthUrl"
,
"http://test"
)
.
toString
();
Application
value
=
objectMapper
.
readValue
(
json
,
Application
.
class
);
...
...
@@ -66,14 +65,14 @@ public class ApplicationTest {
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
test_name_expected
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_name_expected
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
""
).
put
(
"managementUrl"
,
"http://test"
)
.
put
(
"healthUrl"
,
"http://health"
).
put
(
"serviceUrl"
,
"http://service"
).
toString
();
objectMapper
.
readValue
(
json
,
Application
.
class
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
test_healthUrl_expected
()
throws
JsonProcessingException
,
IO
Exception
{
public
void
test_healthUrl_expected
()
throws
Exception
{
String
json
=
new
JSONObject
().
put
(
"name"
,
"test"
).
put
(
"managementUrl"
,
"http://test"
)
.
put
(
"healthUrl"
,
""
).
put
(
"serviceUrl"
,
"http://service"
).
toString
();
objectMapper
.
readValue
(
json
,
Application
.
class
);
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/registry/web/RegistryControllerTest.java
View file @
4bc9d3a9
...
...
@@ -23,6 +23,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import
java.io.UnsupportedEncodingException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -41,10 +42,20 @@ import de.codecentric.boot.admin.registry.store.SimpleApplicationStore;
public
class
RegistryControllerTest
{
private
static
final
String
APPLICATION_TEST_JSON
=
new
JSONObject
().
put
(
"name"
,
"test"
)
.
put
(
"healthUrl"
,
"http://localhost/mgmt/health"
).
toString
();
private
static
final
String
APPLICATION_TWICE_JSON
=
new
JSONObject
().
put
(
"name"
,
"twice"
)
.
put
(
"healthUrl"
,
"http://localhost/mgmt/health"
).
toString
();
private
static
final
String
APPLICATION_TEST_JSON
;
private
static
final
String
APPLICATION_TWICE_JSON
;
static
{
try
{
APPLICATION_TEST_JSON
=
new
JSONObject
().
put
(
"name"
,
"test"
)
.
put
(
"healthUrl"
,
"http://localhost/mgmt/health"
).
toString
();
APPLICATION_TWICE_JSON
=
new
JSONObject
().
put
(
"name"
,
"twice"
)
.
put
(
"healthUrl"
,
"http://localhost/mgmt/health"
).
toString
();
}
catch
(
JSONException
ex
)
{
throw
new
ExceptionInInitializerError
(
ex
);
}
}
private
MockMvc
mvc
;
@Before
...
...
@@ -87,7 +98,6 @@ public class RegistryControllerTest {
mvc
.
perform
(
get
(
"/api/applications/{id}"
,
id
)).
andExpect
(
status
().
isNotFound
());
}
private
String
extractId
(
MvcResult
result
)
throws
UnsupportedEncodingException
{
return
JsonPath
.
compile
(
"$.id"
).
read
(
result
.
getResponse
().
getContentAsString
());
}
...
...
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