added tests
This commit is contained in:
@ -43,9 +43,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<artifactId>shared-jeeutil</artifactId>
|
<artifactId>shared-jeeutil</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax</groupId>
|
<groupId>javax</groupId>
|
||||||
<artifactId>javaee-api</artifactId>
|
<artifactId>javaee-api</artifactId>
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
package de.muehlencord.shared.account.business;
|
||||||
|
|
||||||
|
import de.muehlencord.shared.account.entity.ConfigEntity;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author joern.muehlencord
|
||||||
|
*/
|
||||||
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
public class ConfigServiceTest {
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private EntityManager entityManagerMock;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void init() {
|
||||||
|
ConfigEntity configEntity = new ConfigEntity ("account.maxFailedLogins");
|
||||||
|
configEntity.setConfigValue("7");
|
||||||
|
when (entityManagerMock.find(ConfigEntity.class, "account.maxFailedLogins")).thenReturn (configEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetMaxFailedLogins() {
|
||||||
|
configService.init();
|
||||||
|
assertEquals ("maxFailedLogins", 7, configService.getMaxFailedLogins());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
12
pom.xml
12
pom.xml
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
<!-- dependencies library version -->
|
<!-- dependencies library version -->
|
||||||
<junit.version>4.12</junit.version>
|
<junit.version>4.12</junit.version>
|
||||||
|
<mockito.version>1.10.19</mockito.version>
|
||||||
<commons-codec.version>1.10</commons-codec.version>
|
<commons-codec.version>1.10</commons-codec.version>
|
||||||
<commons-net.version>3.3</commons-net.version>
|
<commons-net.version>3.3</commons-net.version>
|
||||||
<commons-lang3.version>3.4</commons-lang3.version>
|
<commons-lang3.version>3.4</commons-lang3.version>
|
||||||
@ -48,12 +49,16 @@
|
|||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>${junit.version}</version>
|
<version>${junit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<version>${mockito.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
@ -154,6 +159,11 @@
|
|||||||
<artifactId>shared-util</artifactId>
|
<artifactId>shared-util</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
|
<artifactId>shared-jeeutil</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
Reference in New Issue
Block a user