Skip to content
Snippets Groups Projects
Commit 4944c2b9 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Added even more unit tests.

Change-Id: If82059a930f636b22a3ea49bc4a80978124e62ec
parent 017e56a9
No related branches found
No related tags found
No related merge requests found
/******************************************************************************
* *
* Copyright: (c) Syncleus, Inc. *
* *
* You may redistribute and modify this source code under the terms and *
* conditions of the Open Source Community License - Type C version 1.0 *
* or any later version as published by Syncleus, Inc. at www.syncleus.com. *
* There should be a copy of the license included with this file. If a copy *
* of the license is not included you are granted no right to distribute or *
* otherwise use this file except through a legal and valid license. You *
* should also contact Syncleus, Inc. at the information below if you cannot *
* find a license: *
* *
* Syncleus, Inc. *
* 2604 South 12th Street *
* Philadelphia, PA 19148 *
* *
******************************************************************************/
package com.syncleus.grail.graph.action;
public abstract class AbstractBadActionNode implements BadActionNode {
@Override
public void badArguments(final String thisIsBad) {
}
@Action("badAccess")
protected void badAccess() {
}
}
/******************************************************************************
* *
* Copyright: (c) Syncleus, Inc. *
* *
* You may redistribute and modify this source code under the terms and *
* conditions of the Open Source Community License - Type C version 1.0 *
* or any later version as published by Syncleus, Inc. at www.syncleus.com. *
* There should be a copy of the license included with this file. If a copy *
* of the license is not included you are granted no right to distribute or *
* otherwise use this file except through a legal and valid license. You *
* should also contact Syncleus, Inc. at the information below if you cannot *
* find a license: *
* *
* Syncleus, Inc. *
* 2604 South 12th Street *
* Philadelphia, PA 19148 *
* *
******************************************************************************/
package com.syncleus.grail.graph.action;
import com.syncleus.grail.graph.BlankGraphFactory;
import com.syncleus.grail.neural.ActivationNeuron;
import com.syncleus.grail.neural.activation.*;
import com.tinkerpop.frames.FramedTransactionalGraph;
import junit.framework.Assert;
import org.junit.Test;
import java.lang.reflect.*;
public class AbstractPrioritySerialTriggerTest {
@Test(expected = UndeclaredThrowableException.class )
public void testBadArguments() {
final FramedTransactionalGraph<?> graph = BlankGraphFactory.makeTinkerGraph();
final BadActionNode badNode = graph.addVertex(null, BadActionNode.class);
final PrioritySerialTrigger trigger = graph.addVertex(null, PrioritySerialTrigger.class);
final PrioritySerialTriggerEdge triggerEdge = graph.addEdge(null, trigger.asVertex(), badNode.asVertex(), "triggers", PrioritySerialTriggerEdge.class);
triggerEdge.setTriggerPriority(0);
triggerEdge.setTriggerAction("badArguments");
try {
trigger.trigger();
}
catch( final UndeclaredThrowableException caught ) {
Assert.assertTrue(InvocationTargetException.class.equals(caught.getUndeclaredThrowable().getClass()));
throw caught;
}
}
@Test(expected = UndeclaredThrowableException.class)
public void testBadAccess() {
final FramedTransactionalGraph<?> graph = BlankGraphFactory.makeTinkerGraph();
final BadActionNode badNode = graph.addVertex(null, BadActionNode.class);
final PrioritySerialTrigger trigger = graph.addVertex(null, PrioritySerialTrigger.class);
final PrioritySerialTriggerEdge triggerEdge = graph.addEdge(null, trigger.asVertex(), badNode.asVertex(), "triggers", PrioritySerialTriggerEdge.class);
triggerEdge.setTriggerPriority(0);
triggerEdge.setTriggerAction("badAccess");
try {
trigger.trigger();
}
catch( final UndeclaredThrowableException caught ) {
Assert.assertTrue(InvocationTargetException.class.equals(caught.getUndeclaredThrowable().getClass()));
throw caught;
}
}
@Test(expected = UndeclaredThrowableException.class)
public void testUnfoundAction() {
final FramedTransactionalGraph<?> graph = BlankGraphFactory.makeTinkerGraph();
final BadActionNode badNode = graph.addVertex(null, BadActionNode.class);
final PrioritySerialTrigger trigger = graph.addVertex(null, PrioritySerialTrigger.class);
final PrioritySerialTriggerEdge triggerEdge = graph.addEdge(null, trigger.asVertex(), badNode.asVertex(), "triggers", PrioritySerialTriggerEdge.class);
triggerEdge.setTriggerPriority(0);
triggerEdge.setTriggerAction("wontFindThis");
try {
trigger.trigger();
}
catch( final UndeclaredThrowableException caught ) {
Assert.assertTrue(InvocationTargetException.class.equals(caught.getUndeclaredThrowable().getClass()));
throw caught;
}
}
}
/******************************************************************************
* *
* Copyright: (c) Syncleus, Inc. *
* *
* You may redistribute and modify this source code under the terms and *
* conditions of the Open Source Community License - Type C version 1.0 *
* or any later version as published by Syncleus, Inc. at www.syncleus.com. *
* There should be a copy of the license included with this file. If a copy *
* of the license is not included you are granted no right to distribute or *
* otherwise use this file except through a legal and valid license. You *
* should also contact Syncleus, Inc. at the information below if you cannot *
* find a license: *
* *
* Syncleus, Inc. *
* 2604 South 12th Street *
* Philadelphia, PA 19148 *
* *
******************************************************************************/
package com.syncleus.grail.graph.action;
import com.syncleus.grail.graph.Node;
import com.tinkerpop.frames.modules.javahandler.JavaHandler;
public interface BadActionNode extends Node {
@JavaHandler
@Action("badArguments")
void badArguments(String thisIsBad);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment