io.github.fssantana:unit-mock

A tool to create filled instances mocks for unit testing purpose.

Лицензия

Лицензия

BSD
Категории

Категории

Ant Компиляция и сборка
Группа

Группа

io.github.fssantana
Идентификатор

Идентификатор

unit-mock
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

io.github.fssantana:unit-mock
A tool to create filled instances mocks for unit testing purpose.
Ссылка на сайт

Ссылка на сайт

https://github.com/fssantana/unit-mock
Организация-разработчик

Организация-разработчик

jcabi.com
Система контроля версий

Система контроля версий

http://github.com/fssantana/unit-mock/tree/master

Скачать unit-mock

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.fssantana/unit-mock/ -->
<dependency>
    <groupId>io.github.fssantana</groupId>
    <artifactId>unit-mock</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.fssantana/unit-mock/
implementation 'io.github.fssantana:unit-mock:1.0.0'
// https://jarcasting.com/artifacts/io.github.fssantana/unit-mock/
implementation ("io.github.fssantana:unit-mock:1.0.0")
'io.github.fssantana:unit-mock:jar:1.0.0'
<dependency org="io.github.fssantana" name="unit-mock" rev="1.0.0">
  <artifact name="unit-mock" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.fssantana', module='unit-mock', version='1.0.0')
)
libraryDependencies += "io.github.fssantana" % "unit-mock" % "1.0.0"
[io.github.fssantana/unit-mock "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar 2.6.1

test (3)

Идентификатор библиотеки Тип Версия
org.mockito : mockito-core jar 2.21.0
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3

Модули Проекта

Данный проект не имеет модулей.

Unit Mock


Build Status

Set of tools to help build mocks for unit testing purpose.

Usage

  • Use methods in UnitMock class to create simple mocks:
public class TestExample {

    @Test
    public void testLocalDate(){
        LocalDate localDate = UnitMock.localDate();
    }
    
    @Test
    public void testLocalDateTime(){
        LocalDate localDate = UnitMock.localDateTime();
    }
}
  • You can build an filled instance like this:
public class TestExample {

    @Test
    public void test(){
        MyClass myInstance = UnitMock.buildFor(MyClass.class);
    }
    
    /**
    * This will fill all subclasses with 10 depth 
    */
    @Test
    public void testInDepth(){
        MyClass myInstance = UnitMock.buildFor(MyClass.class, 10);
    }
    
}
  • You can mock incremental integer (like a relational database)
public class TestExample {
    
    @Test
    public void integerSequenceTest(){
    UnitMockIntegerSequence sequence = UnitMockIntegerSequence
                    .init()
                    .startWith(0)
                    .incrementStep(2)
                    .build();
    
            Integer firstId = sequence.next();   //0
            Integer secondId = sequence.next();  //2
            Integer thirdId = sequence.next();   //4
    }
}

Версии библиотеки

Версия
1.0.0