Patere

https://github.com/lkrnac/patere

License

License

Categories

Categories

Net
GroupId

GroupId

net.lkrnac.lib
ArtifactId

ArtifactId

patere
Last Version

Last Version

0.2.4
Release Date

Release Date

Type

Type

jar
Description

Description

Patere
https://github.com/lkrnac/patere
Project URL

Project URL

https://github.com/lkrnac/patere
Source Code Management

Source Code Management

https://github.com/lkrnac/patere

Download patere

How to add to project

<!-- https://jarcasting.com/artifacts/net.lkrnac.lib/patere/ -->
<dependency>
    <groupId>net.lkrnac.lib</groupId>
    <artifactId>patere</artifactId>
    <version>0.2.4</version>
</dependency>
// https://jarcasting.com/artifacts/net.lkrnac.lib/patere/
implementation 'net.lkrnac.lib:patere:0.2.4'
// https://jarcasting.com/artifacts/net.lkrnac.lib/patere/
implementation ("net.lkrnac.lib:patere:0.2.4")
'net.lkrnac.lib:patere:jar:0.2.4'
<dependency org="net.lkrnac.lib" name="patere" rev="0.2.4">
  <artifact name="patere" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.lkrnac.lib', module='patere', version='0.2.4')
)
libraryDependencies += "net.lkrnac.lib" % "patere" % "0.2.4"
[net.lkrnac.lib/patere "0.2.4"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.2.1

test (2)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
org.testng : testng jar 6.8.7

Project Modules

There are no modules declared in this project.

Patere

Tiny library for building path of test resources based on package, class name and optionally test method name. This can help keep test suite organized if it heavily uses some file resources. Developer can just drop resources belonging to the test into directory of certain structure and use Patere in test to build the test resources path.

It uses stack trace of current thread to build the path, therefore it's not suitable for production.

Uses Java 7.

Maven dependency

<dependency>
	<groupId>net.lkrnac.lib</groupId>
	<artifactId>patere</artifactId>
	<version>${version}</version>
	<scope>test</scope>
</dependency>

Find version in GitHub releases tab.

API

JavaDoc of current development branch

Examples

If stack trace is net.lkrnac.someapp.AppTest.testSomeMethod(), Patere builds following test resource paths:

String testResourcesPath = new Patere().getResourcesPathForMethod(); 
//testResourcesPath == "src/test/resources/net.lkrnac.someapp/AppTest/testSomeMethod/"

testResourcesPath = new Patere(false).getResourcesPathForMethod(); 
//testResourcesPath == "src/test/resources/net/lkrnac/someapp/AppTest/testSomeMethod/"

testResourcesPath = new Patere().getResourcesPathForClass(this.getClass.getName()); 
//testResourcesPath == "src/test/resources/net.lkrnac.someapp/AppTest/"

testResourcesPath = new Patere(false).getResourcesPathForClass(this.getClass.getName()); 
//testResourcesPath == "src/test/resources/net/lkrnac/someapp/AppTest/"

testResourcesPath = new Patere("test").getResourcesPathForClass(this.getClass.getName()); 
//testResourcesPath == "test/net/lkrnac/someapp/AppTest/"

##Development

Versions

Version
0.2.4