Rules
Rules 1.0
Rules is a small framework which offers JUnit Rules
for the Spring- and Mockito-Framework. For Powermock the rule is part of the framework. Instead using a runner like
@RunWith(MockitoJUnitRunner.class)
you can use the Rule. Especially if you’ve a usecase using more than one runner (e.g. Mockito and Spring together) you can simple use the Rules.
License
/**
Rules
JUnit rules for Spring and Mockito.
Download: https://github.com/simplecommand/SimpleCommandFramework-Examples/tree/master/Rules
Copyright (C) 2016 Manfred Wolff, neusta software development
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
Download
You can download the framework here:
Maven
After doing an mvn package the framework can be registered as followed:
mvn
install
:
install
-
file
-Dfile=<path-to-
file
> -DgroupId=org.mwolff \
-DartifactId=
rules
-Dversion=1.0.0 -Dpackaging=jar
pom.xml
<!-- rule framework -->
<
dependency
>
<
groupId
>org.mwolff</
groupId
>
<
artifactId
>rules</
artifactId
>
<
version
>1.0.0</
version
>
</
dependency
>
Examples
public class TestMockRule {
@Rule
TestRule contextRule = new SpringContextRule(
new String[] { "file:applicationcontext.xml" }, this);
@Rule
public TestRule mockRule = new MockRule(this);
@Autowired
public String bar;
@Mock
public List<String> baz;
@Test
...
}