Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
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
DEMO
spring-boot
Commits
e74da3fa
Commit
e74da3fa
authored
Nov 28, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIXME test additions
parent
3e6c1b43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
21 deletions
+57
-21
DefaultCounterServiceTests.java
...work/boot/actuate/metrics/DefaultCounterServiceTests.java
+17
-7
DefaultGaugeServiceTests.java
...mework/boot/actuate/metrics/DefaultGaugeServiceTests.java
+12
-7
AuthorizationAuditListenerTests.java
...oot/actuate/security/AuthorizationAuditListenerTests.java
+28
-7
No files found.
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/DefaultCounterServiceTests.java
View file @
e74da3fa
...
...
@@ -16,23 +16,33 @@
package
org
.
springframework
.
boot
.
actuate
.
metrics
;
import
org.junit.Ignore
;
import
java.util.Date
;
import
org.junit.Test
;
import
org.springframework.boot.actuate.metrics.DefaultCounterService
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
* Tests for {@link DefaultCounterService}.
*/
@Ignore
public
class
DefaultCounterServiceTests
{
// FIXME
private
MetricRepository
repository
=
mock
(
MetricRepository
.
class
);
private
DefaultCounterService
service
=
new
DefaultCounterService
(
this
.
repository
);
@Test
public
void
test
()
{
fail
(
"Not yet implemented"
);
public
void
incrementPrependsCounter
()
{
this
.
service
.
increment
(
"foo"
);
verify
(
this
.
repository
).
increment
(
eq
(
"counter.foo"
),
eq
(
1
),
any
(
Date
.
class
));
}
@Test
public
void
decrementPrependsCounter
()
{
this
.
service
.
decrement
(
"foo"
);
verify
(
this
.
repository
).
increment
(
eq
(
"counter.foo"
),
eq
(-
1
),
any
(
Date
.
class
));
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/DefaultGaugeServiceTests.java
View file @
e74da3fa
...
...
@@ -16,23 +16,28 @@
package
org
.
springframework
.
boot
.
actuate
.
metrics
;
import
org.junit.Ignore
;
import
java.util.Date
;
import
org.junit.Test
;
import
org.springframework.boot.actuate.metrics.DefaultGaugeService
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
* Tests for {@link DefaultGaugeService}.
*/
@Ignore
public
class
DefaultGaugeServiceTests
{
// FIXME
private
MetricRepository
repository
=
mock
(
MetricRepository
.
class
);
private
DefaultGaugeService
service
=
new
DefaultGaugeService
(
this
.
repository
);
@Test
public
void
test
()
{
fail
(
"Not yet implemented"
);
public
void
setPrependsGuager
()
{
this
.
service
.
set
(
"foo"
,
2.3
);
verify
(
this
.
repository
).
set
(
eq
(
"gauge.foo"
),
eq
(
2.3
),
any
(
Date
.
class
));
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java
View file @
e74da3fa
...
...
@@ -16,23 +16,44 @@
package
org
.
springframework
.
boot
.
actuate
.
security
;
import
org.junit.Ignore
;
import
java.util.Arrays
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.springframework.boot.actuate.security.AuthenticationAuditListener
;
import
org.mockito.Mockito
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.security.access.AccessDeniedException
;
import
org.springframework.security.access.ConfigAttribute
;
import
org.springframework.security.access.SecurityConfig
;
import
org.springframework.security.access.event.AuthorizationFailureEvent
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
Matchers
.
anyObject
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
* Tests for {@link AuthenticationAuditListener}.
*/
@Ignore
public
class
AuthorizationAuditListenerTests
{
// FIXME
private
AuthorizationAuditListener
listener
=
new
AuthorizationAuditListener
();
private
ApplicationEventPublisher
publisher
=
Mockito
.
mock
(
ApplicationEventPublisher
.
class
);
@Before
public
void
init
()
{
this
.
listener
.
setApplicationEventPublisher
(
this
.
publisher
);
}
@Test
public
void
test
()
{
fail
(
"Not yet implemented"
);
public
void
testAuthenticationSuccess
()
{
this
.
listener
.
onApplicationEvent
(
new
AuthorizationFailureEvent
(
this
,
Arrays
.<
ConfigAttribute
>
asList
(
new
SecurityConfig
(
"USER"
)),
new
UsernamePasswordAuthenticationToken
(
"user"
,
"password"
),
new
AccessDeniedException
(
"Bad user"
)));
verify
(
this
.
publisher
).
publishEvent
((
ApplicationEvent
)
anyObject
());
}
}
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