Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'luksa_https/weld894' into luksa_20120305
- Loading branch information
Showing
7 changed files
with
104 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
tests-arquillian/src/test/java/org/jboss/weld/tests/interceptors/exceptions/Foo.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,19 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
import org.jboss.weld.exceptions.WeldException; | ||
|
||
/** | ||
* | ||
*/ | ||
@FooBinding | ||
public class Foo { | ||
|
||
public void throwCheckedException() throws FooCheckedException { | ||
throw new FooCheckedException(); | ||
} | ||
|
||
public void throwUncheckedException() throws FooUncheckedException { | ||
throw new FooUncheckedException(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
tests-arquillian/src/test/java/org/jboss/weld/tests/interceptors/exceptions/FooBinding.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,18 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
import javax.interceptor.InterceptorBinding; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* | ||
*/ | ||
@Inherited | ||
@InterceptorBinding | ||
@Target({ElementType.TYPE, ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface FooBinding { | ||
} |
7 changes: 7 additions & 0 deletions
7
...llian/src/test/java/org/jboss/weld/tests/interceptors/exceptions/FooCheckedException.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,7 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
/** | ||
* | ||
*/ | ||
public class FooCheckedException extends Exception { | ||
} |
7 changes: 7 additions & 0 deletions
7
...ian/src/test/java/org/jboss/weld/tests/interceptors/exceptions/FooUncheckedException.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,7 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
/** | ||
* | ||
*/ | ||
public class FooUncheckedException extends RuntimeException { | ||
} |
32 changes: 32 additions & 0 deletions
32
...t/java/org/jboss/weld/tests/interceptors/exceptions/InterceptorExceptionWrappingTest.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,32 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.BeanArchive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* author Marko Luksa | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class InterceptorExceptionWrappingTest { | ||
@Deployment | ||
public static Archive<?> deploy() { | ||
return ShrinkWrap.create(BeanArchive.class) | ||
.intercept(MyInterceptor.class) | ||
.addPackage(InterceptorExceptionWrappingTest.class.getPackage()); | ||
} | ||
|
||
@Test(expected = FooCheckedException.class) | ||
public void testCheckedExceptionIsNotWrapped(Foo foo) throws Exception { | ||
foo.throwCheckedException(); | ||
} | ||
|
||
@Test(expected = FooUncheckedException.class) | ||
public void testUncheckedExceptionIsNotWrapped(Foo foo) throws Exception { | ||
foo.throwUncheckedException(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...-arquillian/src/test/java/org/jboss/weld/tests/interceptors/exceptions/MyInterceptor.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,19 @@ | ||
package org.jboss.weld.tests.interceptors.exceptions; | ||
|
||
import javax.interceptor.AroundInvoke; | ||
import javax.interceptor.Interceptor; | ||
import javax.interceptor.InvocationContext; | ||
|
||
/** | ||
* | ||
*/ | ||
@Interceptor | ||
@FooBinding | ||
public class MyInterceptor { | ||
|
||
@AroundInvoke | ||
public Object aroundInvoke(final InvocationContext invocation) throws Exception { | ||
return invocation.proceed(); | ||
} | ||
|
||
} |