Created
October 17, 2014 17:41
-
-
Save gabanox/6f8361cadc7d58c8911f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.telcel.aspects; | |
import static org.junit.Assert.*; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.test.context.ContextConfiguration; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
import com.telcel.aspects.PerformanceAspect; | |
import com.telcel.repository.MyRepository; | |
import com.telcel.service.MyService; | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration("/system-configuration.xml") | |
public class PerformanceAspectTest { | |
@Autowired | |
PerformanceAspect performanceAspect; | |
@Autowired | |
MyService myService; | |
@Autowired | |
MyRepository myRepository; | |
@Before | |
public void setUp() { | |
performanceAspect.resetCalled(); | |
} | |
@Test | |
public void performanceIsCalledForRepositories() { | |
assertFalse(performanceAspect.isCalled()); | |
myRepository.doIt(); | |
assertTrue(performanceAspect.isCalled()); | |
} | |
@Test | |
public void performanceIsNotCalledForServices() { | |
assertFalse(performanceAspect.isCalled()); | |
myService.doIt(); | |
assertFalse(performanceAspect.isCalled()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment