Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Add plugin test provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mapingo committed Sep 6, 2017
1 parent 00d5efc commit 0ffeef9
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pojo-plugin-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<excludes>
</excludes>
<generatorProperties>
<pojo-plugin-provider>uk.gov.justice.generation.pojo.generators.plugin.DefaultPluginProvider</pojo-plugin-provider>
<pojo-plugin-provider>uk.gov.justice.generation.pojo.generators.plugin.PluginTestProvider</pojo-plugin-provider>
</generatorProperties>
</configuration>
<goals>
Expand All @@ -86,7 +86,7 @@
<dependencies>
<dependency>
<groupId>uk.gov.justice.generators</groupId>
<artifactId>pojo-generation-core</artifactId>
<artifactId>pojo-plugin-test-provider</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
28 changes: 28 additions & 0 deletions pojo-plugin-test-provider/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jsonschema-pojo-generator</artifactId>
<groupId>uk.gov.justice.generators</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>pojo-plugin-test-provider</artifactId>

<dependencies>
<dependency>
<groupId>uk.gov.justice.generators</groupId>
<artifactId>pojo-generation-core</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package uk.gov.justice.generation.pojo.generators.plugin;

import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;

import java.util.List;

public class PluginTestProvider implements PluginProvider {

@Override
public List<PluginClassGeneratable> pluginClassGenerators() {
return asList(
new EventAnnotationGenerator(),
new SerializableGenerator(),
new FieldAndMethodGenerator());
}

@Override
public List<TypeNamePlugin> typeNamePlugins() {
return emptyList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package uk.gov.justice.generation.pojo.generators.plugin;

import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import java.util.List;

import org.junit.Test;

public class PluginTestProviderTest {

@Test
@SuppressWarnings("unchecked")
public void shouldProvideDefaultListOfPluginClassGenerators() throws Exception {
final List<PluginClassGeneratable> pluginClassGenerators = new PluginTestProvider().pluginClassGenerators();

assertThat(pluginClassGenerators.size(), is(3));
assertThat(pluginClassGenerators, hasItems(
instanceOf(EventAnnotationGenerator.class),
instanceOf(SerializableGenerator.class),
instanceOf(FieldAndMethodGenerator.class)));
}

@Test
public void shouldProvideDefaultListOfTypeNamePlugins() throws Exception {

final List<TypeNamePlugin> typeNamePlugins = new PluginTestProvider().typeNamePlugins();

assertThat(typeNamePlugins.size(), is(0));
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<module>pojo-generator-core</module>
<module>integration-test</module>
<module>pojo-plugin-it</module>
<module>pojo-plugin-test-provider</module>
</modules>

<properties>
Expand Down

0 comments on commit 0ffeef9

Please sign in to comment.