Commit 9c8d4b37 authored by Matija Obreza's avatar Matija Obreza

test scope for mockito-all

parent 1ee1f901
......@@ -483,6 +483,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
......
package org.genesys2.unit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.app.VelocityEngine;
import org.genesys2.server.persistence.domain.ActivityPostRepository;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.HtmlSanitizer;
import org.genesys2.server.service.impl.ContentServiceImpl;
import org.genesys2.server.service.impl.OWASPSanitizer;
import org.genesys2.server.test.JpaDataConfig;
import org.genesys2.server.test.PropertyPlacholderInitializer;
import org.genesys2.spring.config.HazelcastConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = ContentServiceTest.Config.class, initializers = PropertyPlacholderInitializer.class)
@ActiveProfiles("dev")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class ContentServiceTest {
private final Log LOG = LogFactory.getLog(ContentServiceTest.class);
@Import({JpaDataConfig.class, HazelcastConfig.class})
@PropertySource({"classpath:application.properties", "classpath:spring/spring.properties"})
public static class Config {
@Bean
public CacheManager cacheManager() {
return new NoOpCacheManager();
}
@Bean
public ContentService contentService() {
return new ContentServiceImpl();
}
@Bean
public HtmlSanitizer htmlSanitizer() {
return new OWASPSanitizer();
}
@Bean
public VelocityEngine velocityEngine() {
return new VelocityEngine();
}
}
@Autowired
private ContentService contentService;
@Autowired
private ActivityPostRepository postRepository;
@Before
public void setUp() {
contentService.createActivityPost("title of activity post", "body of activity post");
}
@Test
public void getDefaultLocaleTest() {
LOG.info("Start test-method getDefaultLocaleTest");
assertNotNull(contentService.getDefaultLocale());
LOG.info("Test getDefaultLocaleTest is passed!");
}
@Test
public void lastNewsTest() {
LOG.info("Start test-method lastNewsTest");
contentService.lastNews();
LOG.info("Test lastNewsTest is passed!");
}
}
......@@ -3,11 +3,9 @@ package org.genesys2.unit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.app.VelocityEngine;
import org.easymock.EasyMock;
import org.genesys2.server.exception.UserException;
import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.impl.Article;
import org.genesys2.server.model.impl.ClassPK;
import org.genesys2.server.model.impl.User;
import org.genesys2.server.model.impl.VerificationToken;
import org.genesys2.server.persistence.domain.ArticleRepository;
......@@ -23,7 +21,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.NoOpCacheManager;
......@@ -45,7 +42,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
......@@ -124,15 +120,9 @@ public class EmailVerificationServiceTest {
@Autowired
private ContentService contentService;
@Autowired
private EMailService eMailService;
@Autowired
private UserService userService;
@Autowired
private ClassPKRepository classPkRepository;
@Autowired
private ArticleRepository articleRepository;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment