Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JBERET-248] NullPointerException when using artifacts with default-p…
…ackage (#79) * Fixed nullpointer exception when using artifacts with default-package. * revert parts other than the part of the cause of NPE
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import javax.batch.api.AbstractBatchlet; | ||
|
||
public class NoPackageBatchlet extends AbstractBatchlet { | ||
@Override | ||
public String process() throws Exception { | ||
return null; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
jberet-core/src/test/java/org/jberet/creation/AbstractArtifactFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.jberet.creation; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class AbstractArtifactFactoryTest { | ||
|
||
private AbstractArtifactFactory factory = new AbstractArtifactFactory() { | ||
@Override | ||
public Object create(String ref, Class<?> cls, ClassLoader classLoader) throws Exception { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Class<?> getArtifactClass(String ref, ClassLoader classLoader) { | ||
return null; | ||
} | ||
}; | ||
|
||
private Class noPackageBatchletClass; | ||
private Object noPackageBatchlet; | ||
|
||
@Before | ||
public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException { | ||
noPackageBatchletClass = Class.forName("NoPackageBatchlet"); | ||
noPackageBatchlet = noPackageBatchletClass.newInstance(); | ||
} | ||
|
||
@Test | ||
public void testDestroyShouldNotFailForDefaultPackage() { | ||
factory.destroy(noPackageBatchlet); | ||
} | ||
|
||
@Test | ||
public void testDoInjectionShouldNotFailForDefaultPackage() throws Exception { | ||
factory.doInjection(noPackageBatchlet, noPackageBatchletClass, null, null, null, null); | ||
} | ||
} |