/*
 * Copyright 2012-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.actuate.security;

import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.actuate.security.AuthenticationAuditListener;

import static org.junit.Assert.fail;

/**
 * Tests for {@link AuthenticationAuditListener}.
 */
@Ignore
public class AuthenticationAuditListenerTests {

	// FIXME

	@Test
	public void test() {
		fail("Not yet implemented");
	}

}

@@ -684,19 +684,19 @@
 g.junit.
-Ign
+Bef
 ore;%0Aimp
@@ -722,24 +722,167 @@
 %0Aimport org.
+mockito.Mockito;%0Aimport org.springframework.context.ApplicationEvent;%0Aimport org.springframework.context.ApplicationEventPublisher;%0Aimport org.
 springframew
@@ -880,37 +880,24 @@
 ingframework
-.boot.actuate
 .security.Au
@@ -894,17 +894,17 @@
 ecurity.
-A
+a
 uthentic
@@ -912,59 +912,609 @@
 tion
-AuditListener;%0A%0Aimport static org.junit.Assert.fail
+.BadCredentialsException;%0Aimport org.springframework.security.authentication.UsernamePasswordAuthenticationToken;%0Aimport org.springframework.security.authentication.event.AuthenticationFailureExpiredEvent;%0Aimport org.springframework.security.authentication.event.AuthenticationSuccessEvent;%0Aimport org.springframework.security.core.authority.AuthorityUtils;%0Aimport org.springframework.security.core.userdetails.User;%0Aimport org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent;%0A%0Aimport static org.mockito.Matchers.anyObject;%0Aimport static org.mockito.Mockito.verify
 ;%0A%0A/
@@ -1574,16 +1574,8 @@
  */%0A
-@Ignore%0A
 publ
@@ -1624,75 +1624,1216 @@
 %7B%0A%0A%09
-// FIXME%0A%0A%09@Test%0A%09public void test() %7B%0A%09%09fail(%22Not yet implemented%22
+private AuthenticationAuditListener listener = new AuthenticationAuditListener();%0A%0A%09private ApplicationEventPublisher publisher = Mockito%0A%09%09%09.mock(ApplicationEventPublisher.class);%0A%0A%09@Before%0A%09public void init() %7B%0A%09%09this.listener.setApplicationEventPublisher(this.publisher);%0A%09%7D%0A%0A%09@Test%0A%09public void testAuthenticationSuccess() %7B%0A%09%09this.listener.onApplicationEvent(new AuthenticationSuccessEvent(%0A%09%09%09%09new UsernamePasswordAuthenticationToken(%22user%22, %22password%22)));%0A%09%09verify(this.publisher).publishEvent((ApplicationEvent) anyObject());%0A%09%7D%0A%0A%09@Test%0A%09public void testAuthenticationFailed() %7B%0A%09%09this.listener.onApplicationEvent(new AuthenticationFailureExpiredEvent(%0A%09%09%09%09new UsernamePasswordAuthenticationToken(%22user%22, %22password%22),%0A%09%09%09%09new BadCredentialsException(%22Bad user%22)));%0A%09%09verify(this.publisher).publishEvent((ApplicationEvent) anyObject());%0A%09%7D%0A%0A%09@Test%0A%09public void testAuthenticationSwitch() %7B%0A%09%09this.listener.onApplicationEvent(new AuthenticationSwitchUserEvent(%0A%09%09%09%09new UsernamePasswordAuthenticationToken(%22user%22, %22password%22), new User(%0A%09%09%09%09%09%09%22user%22, %22password%22, AuthorityUtils%0A%09%09%09%09%09%09%09%09.commaSeparatedStringToAuthorityList(%22USER%22))));%0A%09%09verify(this.publisher).publishEvent((ApplicationEvent) anyObject()
 );%0A%09

Add tests to FIXME