Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix user issue by adding AuditService as @Component

  • Loading branch information...
commit ad27d432952819726583184e64748f044e9edbe3 1 parent fb6e5af
@cbeams cbeams authored
View
9 SPR-8726/src/test/java/org/mycompany/audit/AuditAspectTests.java
@@ -7,16 +7,19 @@
import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
public class AuditAspectTests extends BaseTestClass
{
@Autowired
private IAuditRepository auditRepository;
+
+ @Autowired
+ private AuditService service;
@Test
public void testAudit()
{
- AuditService service = new AuditService();
// make sure call IS NOT audited
service.unAuditedCall();
assertThat(auditRepository.count(), CoreMatchers.is(0L));
@@ -26,6 +29,9 @@ public void testAudit()
assertThat(auditRepository.count(), CoreMatchers.is(1L));
}
+}
+
+ @Component
class AuditService
{
@Auditable(actionCode = "auditedCall", auditMessage = "value returned was %r%")
@@ -39,4 +45,3 @@ public String unAuditedCall()
return "current time is " + new Date();
}
}
-}
Please sign in to comment.
Something went wrong with that request. Please try again.