|
| 1 | +/* |
| 2 | + * To change this license header, choose License Headers in Project Properties. |
| 3 | + * To change this template file, choose Tools | Templates |
| 4 | + * and open the template in the editor. |
| 5 | + */ |
| 6 | + |
| 7 | +package org.javaee7.ejb.stateless; |
| 8 | + |
| 9 | +import javax.ejb.EJB; |
| 10 | +import org.javaee7.ejb.stateless.remote.Account; |
| 11 | +import org.jboss.arquillian.container.test.api.Deployment; |
| 12 | +import org.jboss.arquillian.container.test.api.TargetsContainer; |
| 13 | +import org.jboss.arquillian.junit.Arquillian; |
| 14 | +import org.jboss.shrinkwrap.api.ShrinkWrap; |
| 15 | +import org.jboss.shrinkwrap.api.spec.WebArchive; |
| 16 | +import org.junit.Test; |
| 17 | +import static org.junit.Assert.*; |
| 18 | +import org.junit.runner.RunWith; |
| 19 | + |
| 20 | +/** |
| 21 | + * @author Arun Gupta |
| 22 | + */ |
| 23 | +@RunWith(Arquillian.class) |
| 24 | +public class AccountSessionBeanWithInterfaceTest { |
| 25 | + @EJB Account bean; |
| 26 | + |
| 27 | + /** |
| 28 | + * Arquillian specific method for creating a file which can be deployed |
| 29 | + * while executing the test. |
| 30 | + * |
| 31 | + * @return a war file |
| 32 | + */ |
| 33 | + @Deployment |
| 34 | + @TargetsContainer("wildfly-arquillian") |
| 35 | + public static WebArchive createDeployment() { |
| 36 | + WebArchive war = ShrinkWrap.create(WebArchive.class). |
| 37 | + addClass(AccountSessionBean.class); |
| 38 | + System.out.println(war.toString(true)); |
| 39 | + return war; |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Test of withdraw method, of class AccountSessionBean. |
| 44 | + */ |
| 45 | + @Test |
| 46 | + public void testWithdraw() { |
| 47 | + System.out.println("withdraw"); |
| 48 | + String result = bean.withdraw((float)5.0); |
| 49 | + assertEquals("Withdrawn: 5.0", result); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Test of deposit method, of class AccountSessionBean. |
| 54 | + */ |
| 55 | + @Test |
| 56 | + public void testDeposit() { |
| 57 | + System.out.println("deposit"); |
| 58 | + String result = bean.withdraw((float)10.0); |
| 59 | + assertEquals("Deposited: 10.0", result); |
| 60 | + } |
| 61 | + |
| 62 | +} |
0 commit comments