Skip to content

Commit

Permalink
Removed redundant controller and fail check from the test
Browse files Browse the repository at this point in the history
  • Loading branch information
VineetReynolds committed Mar 12, 2014
1 parent 9a9c402 commit 204dfa6
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

@RunWith(Arquillian.class)
Expand Down Expand Up @@ -219,20 +221,14 @@ public void testNewOneToManyEagerFetchField() throws Exception
controller.setValueFor("type", otherEntity.getJavaSource().getCanonicalName());
controller.setValueFor("relationshipType", RelationshipType.ONE_TO_MANY);
Assert.assertTrue(controller.canMoveToNextStep());
WizardCommandController next = controller.next();
next.setValueFor("fetchType", FetchType.EAGER);
controller.next();
controller.setValueFor("fetchType", FetchType.EAGER);
Assert.assertTrue(controller.canExecute());
Result result = controller.execute();
Assert.assertFalse(result instanceof Failed);
if (result instanceof CompositeResult)
{
CompositeResult compositeResult = (CompositeResult) result;
Assert.assertEquals("Relationship One-to-Many created", compositeResult.getResults().get(1).getMessage());
}
else
{
fail("Result is of type " + CompositeResult.class.getSimpleName() + " is expected.");
}
assertThat ("Result should be of type CompositeResult", result instanceof CompositeResult, equalTo(true));
CompositeResult compositeResult = (CompositeResult) result;
Assert.assertEquals("Relationship One-to-Many created", compositeResult.getResults().get(1).getMessage());
}
JavaClass javaClass = (JavaClass) entity.getJavaSource();
Assert.assertTrue(javaClass.hasField("accounts"));
Expand Down

0 comments on commit 204dfa6

Please sign in to comment.