11package org .javaee7 .jpa .listeners ;
22
3+ import static java .util .Arrays .asList ;
4+ import static org .hamcrest .CoreMatchers .equalTo ;
5+ import static org .hamcrest .CoreMatchers .is ;
6+ import static org .junit .Assert .assertThat ;
7+
8+ import java .util .List ;
9+
10+ import javax .inject .Inject ;
11+
312import org .apache .commons .lang3 .tuple .ImmutablePair ;
413import org .javaee7 .Parameter ;
514import org .javaee7 .ParameterRule ;
1120import org .junit .Test ;
1221import org .junit .runner .RunWith ;
1322
14- import javax .inject .Inject ;
15-
16- import java .util .Arrays ;
17- import java .util .List ;
18-
19- import static org .hamcrest .CoreMatchers .equalTo ;
20- import static org .hamcrest .CoreMatchers .is ;
21- import static org .hamcrest .collection .IsCollectionWithSize .hasSize ;
22- import static org .junit .Assert .assertThat ;
23-
2423@ RunWith (Arquillian .class )
2524public class JpaListenerInjectionTest {
2625
2726 @ Deployment
2827 public static WebArchive deployment () {
2928 return ShrinkWrap .create (WebArchive .class )
3029 .addPackage ("org.javaee7.jpa.listeners" )
30+ .addPackage (ParameterRule .class .getPackage ())
31+ .addPackages (true , "org.apache.commons.lang3" )
3132 .addAsResource ("META-INF/persistence.xml" )
3233 .addAsResource ("META-INF/create.sql" )
3334 .addAsResource ("META-INF/drop.sql" )
3435 .addAsResource ("META-INF/load.sql" );
3536 }
3637
37- public static final List <ImmutablePair <String , Integer >> movies = Arrays . asList (
38+ public static final List <ImmutablePair <String , Integer >> movies = asList (
3839 new ImmutablePair <>("The Matrix" , 60 ),
3940 new ImmutablePair <>("The Lord of The Rings" , 70 ),
4041 new ImmutablePair <>("Inception" , 80 ),
@@ -45,14 +46,14 @@ public static WebArchive deployment() {
4546 public ParameterRule <ImmutablePair <String , Integer >> rule = new ParameterRule <>(movies );
4647
4748 @ Parameter
48- ImmutablePair <String , Integer > expectedMovie ;
49+ private ImmutablePair <String , Integer > expectedMovie ;
4950
5051 @ Inject
51- MovieBean bean ;
52+ private MovieBean bean ;
5253
5354 @ Test
5455 public void should_provide_movie_rating_via_jpa_listener_injection () {
55- //given
56+ // Given
5657 Movie movie = bean .getMovieByName (expectedMovie .getLeft ());
5758
5859 assertThat (movie .getRating (), is (equalTo (expectedMovie .getRight ())));
0 commit comments