Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.github.publickey:pojo-test-utils

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.publickey:pojo-test-utils

Collection of unit test utility classes to improve code coverage for POJO (Plain Old Java Object) classes

  • 1.0.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

pojo-test-utils

Collection of unit test utility classes to improve code coverage for POJO (Plain Old Java Object) classes

Maven:

<dependency>
  <groupId>com.github.publickey</groupId>
  <artifactId>pojo-test-utils</artifactId>
  <version>1.0.0</version>
  <scope>test</scope>
</dependency>

Note: Library depends on: Java 1.8 JUnit 4.12

Components:

AbstractPojoTester - The main abstract base class meant to be extended by Unit Tests

Usage:

Here's an example of simple Pojo under test

import org.junit.Test;

import com.github.publickey.test.pojo.AbstractPojoTester;

public class MyPojoTest extends AbstractPojoTester {
    @Test
    public void testMyPojo() throws Exception {
        super.testPojoAllConstructors(MyPojo.class);
    }
}

Here's an example of simple Pojo under test

import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;

import com.github.publickey.test.pojo.AbstractPojoTester;

public class MyPojo2Test extends AbstractPojoTester {
    @Before
    public void setUp() throws Exception {
        // set custom value of type String to be provided (i.e. MyPojo2 performs 
        // validation and requires the following format)
        super.putTestValue(String.class, "special-string");
    }

    @Test
    public void testMyPojo2() throws Exception {
        // perform standard POJO test on MyPojo2.class 
        // but also invoke someMethod and make sure no exception is thrown
        super.testPojo(MyPojo2.class, "someMethod");
    }
    
    @Test
    public void testMyPojo2CustomTest() throws Exception {
        // custom custom 
        MyPojo2 myPojo2 = new MyPojo2("Custom value");
        assertEquals("Custom value", myPojo2.calculate());
    }
}

The Maven artifacts are deployed with the Maven Repository Switchboard at: http://repo1.maven.org/maven2/com/github/publickey/pojo-test-utils/

Sample repository configuration

<repository>
	<id>central</id>
	<name>Maven Repository Switchboard</name>
	<layout>default</layout>
	<url>http://repo1.maven.org/maven2/</url>
	<snapshots>
		<enabled>false</enabled>
	</snapshots>
</repository>

The Maven artifacts are also avaialble through with Sonatype at: https://oss.sonatype.org/service/local/repositories/releases/content/

FAQs

Package last updated on 10 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc