Skip to content

Commit

Permalink
Add asserts to DecoratorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
bafco authored and jharting committed Jun 17, 2014
1 parent 37b2ac6 commit 6f1d343
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Expand Up @@ -18,7 +18,6 @@
package org.jboss.weld.tests.decorators.weld1001;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
Expand All @@ -32,20 +31,21 @@
@RunWith(Arquillian.class)
public class DecoratorTest {

@Deployment(name = "decorator")
public static Archive getDeployment() {
@Deployment
public static Archive<?> getDeployment() {
return ShrinkWrap.create(BeanArchive.class)
.decorate(LargeAmountAccount.class)
.addPackage(LargeAmountAccount.class.getPackage());
}

@Test
@OperateOnDeployment("decorator")
public void testDecorators(BusinessObject bo) throws Exception {
System.out.println("a_state = " + bo.getState());
assert 0 == bo.getState();
bo.deposit(2011.0);
bo.withdraw(1509.0);
System.out.println("a_sum = " + bo.getState());
assert 2011 - 1509 == bo.getState();
}

}
Expand Up @@ -29,10 +29,6 @@ public class BusinessObject {
@Inject
Account account;

public void print(String msg) {
System.out.println("msg = " + msg);
}

public void withdraw(int amount) {
account.withdraw(amount);
}
Expand Down
Expand Up @@ -18,7 +18,6 @@
package org.jboss.weld.tests.decorators.weld1021;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
Expand All @@ -32,20 +31,19 @@
@RunWith(Arquillian.class)
public class DecoratorTest {

@Deployment(name = "decorator")
public static Archive getDeployment() {
@Deployment
public static Archive<?> getDeployment() {
return ShrinkWrap.create(BeanArchive.class)
.decorate(ChargeAccount.class)
.addPackage(ChargeAccount.class.getPackage());
}

@Test
@OperateOnDeployment("decorator")
public void testDecorators(BusinessObject bo) throws Exception {
System.out.println("state = " + bo.getState());
assert 0 == bo.getState();
bo.deposit(2012);
bo.withdraw(501);
System.out.println("sum = " + bo.getState());
assert 2012 - 501 - 5 == bo.getState();
}

}

0 comments on commit 6f1d343

Please sign in to comment.