Skip to content

Commit

Permalink
Fixed tests. Added coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriytkach committed Mar 17, 2017
1 parent 1651aa4 commit 4a48571
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
23 changes: 23 additions & 0 deletions pom.xml
Expand Up @@ -28,6 +28,15 @@
<!--suppress MavenModelInspection -->
<distribution.out.dir>${CIRCLE_ARTIFACTS}</distribution.out.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Expand Down Expand Up @@ -102,6 +111,20 @@
<showWarnings>true</showWarnings>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
@@ -1,16 +1,11 @@
package com.yet.spring.core.aspects;

import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.yet.spring.core.beans.Event;
import com.yet.spring.core.loggers.EventLogger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.Test;

import com.yet.spring.core.beans.Event;
import com.yet.spring.core.loggers.EventLogger;
import static org.mockito.Mockito.*;

public class TestConsoleLoggerLimitAspect {

Expand All @@ -19,18 +14,17 @@ public void testAroundLogEvent() throws Throwable {
ProceedingJoinPoint jp = mock(ProceedingJoinPoint.class);
EventLogger mockLogger = mock(EventLogger.class);
Event mockEvent = mock(Event.class);

when(mockLogger.getName()).thenReturn("MockLogger");

ConsoleLoggerLimitAspect aspect = new ConsoleLoggerLimitAspect(2, mockLogger);

aspect.aroundLogEvent(jp, mockEvent);
aspect.aroundLogEvent(jp, mockEvent);
aspect.aroundLogEvent(jp, mockEvent);

verify(jp, atMost(2)).proceed();
verify(mockLogger, atMost(1)).logEvent(mockEvent);
verify(mockEvent, never());
}

}

0 comments on commit 4a48571

Please sign in to comment.