FIXME test additions
This commit is contained in:
parent
3e6c1b435f
commit
e74da3fa73
|
|
@ -16,23 +16,33 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.metrics;
|
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 org.junit.Test;
|
||||||
|
|
||||||
|
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}.
|
* Tests for {@link DefaultCounterService}.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
public class DefaultCounterServiceTests {
|
public class DefaultCounterServiceTests {
|
||||||
|
|
||||||
// FIXME
|
private MetricRepository repository = mock(MetricRepository.class);
|
||||||
|
|
||||||
|
private DefaultCounterService service = new DefaultCounterService(this.repository);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void incrementPrependsCounter() {
|
||||||
fail("Not yet implemented");
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,28 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.metrics;
|
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 org.junit.Test;
|
||||||
|
|
||||||
|
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}.
|
* Tests for {@link DefaultGaugeService}.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
public class DefaultGaugeServiceTests {
|
public class DefaultGaugeServiceTests {
|
||||||
|
|
||||||
// FIXME
|
private MetricRepository repository = mock(MetricRepository.class);
|
||||||
|
|
||||||
|
private DefaultGaugeService service = new DefaultGaugeService(this.repository);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void setPrependsGuager() {
|
||||||
fail("Not yet implemented");
|
this.service.set("foo", 2.3);
|
||||||
|
verify(this.repository).set(eq("gauge.foo"), eq(2.3), any(Date.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,44 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.security;
|
package org.springframework.boot.actuate.security;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import java.util.Arrays;
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.boot.actuate.security.AuthenticationAuditListener;
|
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
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.mockito.Matchers.anyObject;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link AuthenticationAuditListener}.
|
* Tests for {@link AuthenticationAuditListener}.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
public class AuthorizationAuditListenerTests {
|
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
|
@Test
|
||||||
public void test() {
|
public void testAuthenticationSuccess() {
|
||||||
fail("Not yet implemented");
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue