View Javadoc
1   package org.apache.maven.shared.dependency.analyzer.asm;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.junit.Before;
23  import org.junit.Test;
24  import org.objectweb.asm.*;
25  import org.objectweb.asm.signature.SignatureVisitor;
26  
27  import static org.assertj.core.api.Assertions.assertThat;
28  
29  /**
30   * Tests <code>DependencyVisitor</code>.
31   * 
32   * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
33   */
34  public class DependencyVisitorTest
35  {
36      private final ResultCollector resultCollector = new ResultCollector();
37      private DefaultClassVisitor visitor;
38      private MethodVisitor mv;
39  
40      @Before
41      public void setUp()
42      {
43          AnnotationVisitor annotationVisitor = new DefaultAnnotationVisitor( resultCollector );
44          SignatureVisitor signatureVisitor = new DefaultSignatureVisitor( resultCollector );
45          FieldVisitor fieldVisitor = new DefaultFieldVisitor( annotationVisitor, resultCollector );
46          mv = new DefaultMethodVisitor( annotationVisitor, signatureVisitor, resultCollector);
47          visitor = new DefaultClassVisitor( signatureVisitor, annotationVisitor, fieldVisitor, mv, resultCollector);
48      }
49  
50      @Test
51      public void testVisitWithDefaultSuperclass()
52      {
53          // class a.b.c
54          visitor.visit( 50, 0, "a/b/c", null, "java/lang/Object", null );
55  
56          assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object" );
57      }
58  
59      @Test
60      public void testVisitWithSuperclass()
61      {
62          // class a.b.c
63          visitor.visit( 50, 0, "a/b/c", null, "x/y/z", null );
64  
65          assertThat( resultCollector.getDependencies() ).containsOnly( "x.y.z" );
66      }
67  
68      @Test
69      public void testVisitWithInterface()
70      {
71          // class a.b.c implements x.y.z
72          visitor.visit( 50, 0, "a/b/c", null, "java/lang/Object", new String[] { "x/y/z" } );
73  
74          assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "x.y.z" );
75      }
76  
77      @Test
78      public void testVisitWithInterfaces()
79      {
80          // class a.b.c implements p.q.r, x.y.z
81          visitor.visit( 50, 0, "a/b/c", null, "java/lang/Object", new String[] { "p/q/r", "x/y/z" } );
82  
83          assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "p.q.r", "x.y.z" );
84      }
85  
86      @Test
87      public void testVisitWithUnboundedClassTypeParameter()
88      {
89          // class a.b.c<T>
90          String signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;";
91  
92          visitor.visit( 50, 0, "a/b/c", signature, "java/lang/Object", null );
93  
94          assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object" );
95      }
96  
97      @Test
98      public void testVisitWithBoundedClassTypeParameter()
99      {
100         // class a.b.c<T extends x.y.z>
101         String signature = "<T:Lx/y/z;>Ljava/lang/Object;";
102 
103         visitor.visit( 50, 0, "a/b/c", signature, "java/lang/Object", null );
104 
105         assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "x.y.z" );
106     }
107 
108     @Test
109     public void testVisitWithBoundedClassTypeParameters()
110     {
111         // class a.b.c<K extends p.q.r, V extends x.y.z>
112         String signature = "<K:Lp/q/r;V:Lx/y/z;>Ljava/lang/Object;";
113 
114         visitor.visit( 50, 0, "a/b/c", signature, "java/lang/Object", null );
115 
116         assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "p.q.r", "x.y.z" );
117     }
118 
119     @Test
120     public void testVisitWithGenericInterface()
121     {
122         // class a.b.c implements p.q.r<x.y.z>
123         String signature = "Ljava/lang/Object;Lp/q/r<Lx/y/z;>;";
124 
125         visitor.visit( 50, 0, "a/b/c", signature, "java/lang/Object", new String[] { "p.q.r" } );
126 
127         assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "p.q.r", "x.y.z" );
128     }
129 
130     @Test
131     public void testVisitWithInterfaceBound()
132     {
133         // class a.b.c<T> implements x.y.z<T>
134         String signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;Lx/y/z<TT;>;";
135 
136         visitor.visit( 50, 0, "a/b/c", signature, "java/lang/Object", new String[] { "x.y.z" } );
137 
138         assertThat( resultCollector.getDependencies() ).containsOnly( "java.lang.Object", "x.y.z" );
139     }
140 
141     // visitSource tests ------------------------------------------------------
142 
143     @Test
144     public void testVisitSource()
145     {
146         visitor.visitSource( null, null );
147 
148         assertThat( resultCollector.getDependencies() ).isEmpty();
149     }
150 
151     // visitOuterClass tests --------------------------------------------------
152 
153     @Test
154     public void testVisitOuterClass()
155     {
156         // class a.b.c
157         // {
158         //     class ...
159         //     {
160         //     }
161         // }
162         visitor.visitOuterClass( "a/b/c", null, null );
163 
164         assertThat( resultCollector.getDependencies() ).isEmpty();
165     }
166 
167     @Test
168     public void testVisitOuterClassInMethod()
169     {
170         // class a.b.c
171         // {
172         //     x.y.z x(p.q.r p)
173         //     {
174         //         class ...
175         //         {
176         //         }
177         //     }
178         // }
179         visitor.visitOuterClass( "a/b/c", "x", "(Lp/q/r;)Lx/y/z;" );
180 
181         assertThat( resultCollector.getDependencies() ).isEmpty();
182     }
183 
184     // visitAnnotation tests --------------------------------------------------
185 
186     @Test
187     public void testVisitAnnotation()
188     {
189         assertVisitor( visitor.visitAnnotation( "La/b/c;", false ) );
190 
191         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
192     }
193 
194     @Test
195     public void testVisitAnnotationWithRuntimeVisibility()
196     {
197         assertVisitor( visitor.visitAnnotation( "La/b/c;", true ) );
198 
199         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
200     }
201 
202     // visitAttribute tests ---------------------------------------------------
203 
204     @Test
205     public void testVisitAttribute()
206     {
207         visitor.visitAttribute( new MockAttribute( "a" ) );
208 
209         assertThat( resultCollector.getDependencies() ).isEmpty();
210     }
211 
212     // visitInnerClass tests --------------------------------------------------
213 
214     @Test
215     public void testVisitInnerClass()
216     {
217         // TODO: ensure innerName is correct
218 
219         // class a.b.c { class x.y.z { } }
220         visitor.visitInnerClass( "x/y/z", "a/b/c", "z", 0 );
221 
222         assertThat( resultCollector.getDependencies() ).isEmpty();
223     }
224 
225     @Test
226     public void testVisitInnerClassAnonymous()
227     {
228         // class a.b.c { new class x.y.z { } }
229         visitor.visitInnerClass( "x/y/z$1", "a/b/c", null, 0 );
230 
231         assertThat( resultCollector.getDependencies() ).isEmpty();
232     }
233 
234     // visitField tests -------------------------------------------------------
235 
236     @Test
237     public void testVisitField()
238     {
239         // a.b.c a
240         assertVisitor( visitor.visitField( 0, "a", "La/b/c;", null, null ) );
241 
242         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
243     }
244 
245     // TODO: determine actual use of default values
246     // public void testVisitFieldWithValue()
247     // {
248     // }
249 
250     @Test
251     public void testVisitFieldArray()
252     {
253         // a.b.c[] a
254         assertVisitor( visitor.visitField( 0, "a", "[La/b/c;", null, null ) );
255 
256         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
257     }
258 
259     @Test
260     public void testVisitFieldGeneric()
261     {
262         // a.b.c<x.y.z> a
263         assertVisitor( visitor.visitField( 0, "a", "La/b/c;", "La/b/c<Lx/y/z;>;", null ) );
264 
265         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
266     }
267 
268     // visitMethod tests ------------------------------------------------------
269 
270     @Test
271     public void testVisitMethod()
272     {
273         // void a()
274         assertVisitor( visitor.visitMethod( 0, "a", "()V", null, null ) );
275 
276         assertThat( resultCollector.getDependencies() ).isEmpty();
277     }
278 
279     @Test
280     public void testVisitMethodWithPrimitiveArgument()
281     {
282         // void a(int)
283         assertVisitor( visitor.visitMethod( 0, "a", "(I)V", null, null ) );
284 
285         assertThat( resultCollector.getDependencies() ).isEmpty();
286     }
287 
288     @Test
289     public void testVisitMethodWithPrimitiveArrayArgument()
290     {
291         // void a(int[])
292         assertVisitor( visitor.visitMethod( 0, "a", "([I)V", null, null ) );
293 
294         assertThat( resultCollector.getDependencies() ).isEmpty();
295     }
296 
297     @Test
298     public void testVisitMethodWithObjectArgument()
299     {
300         // void a(a.b.c)
301         assertVisitor( visitor.visitMethod( 0, "a", "(La/b/c;)V", null, null ) );
302 
303         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
304     }
305 
306     @Test
307     public void testVisitMethodWithObjectArguments()
308     {
309         // void a(a.b.c, x.y.z)
310         assertVisitor( visitor.visitMethod( 0, "a", "(La/b/c;Lx/y/z;)V", null, null ) );
311 
312         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
313     }
314 
315     @Test
316     public void testVisitMethodWithObjectArrayArgument()
317     {
318         // void a(a.b.c[])
319         assertVisitor( visitor.visitMethod( 0, "a", "([La/b/c;)V", null, null ) );
320 
321         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
322     }
323 
324     @Test
325     public void testVisitMethodWithGenericArgument()
326     {
327         // void a(a.b.c<x.y.z>)
328         assertVisitor( visitor.visitMethod( 0, "a", "(La/b/c;)V", "(La/b/c<Lx/y/z;>;)V", null ) );
329 
330         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
331     }
332 
333     @Test
334     public void testVisitMethodWithPrimitiveReturnType()
335     {
336         // int a()
337         assertVisitor( visitor.visitMethod( 0, "a", "()I", null, null ) );
338 
339         assertThat( resultCollector.getDependencies() ).isEmpty();
340     }
341 
342     @Test
343     public void testVisitMethodWithPrimitiveArrayReturnType()
344     {
345         // int[] a()
346         assertVisitor( visitor.visitMethod( 0, "a", "()[I", null, null ) );
347 
348         assertThat( resultCollector.getDependencies() ).isEmpty();
349     }
350 
351     @Test
352     public void testVisitMethodWithObjectReturnType()
353     {
354         // a.b.c a()
355         assertVisitor( visitor.visitMethod( 0, "a", "()La/b/c;", null, null ) );
356 
357         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
358     }
359 
360     @Test
361     public void testVisitMethodWithObjectArrayReturnType()
362     {
363         // a.b.c[] a()
364         assertVisitor( visitor.visitMethod( 0, "a", "()[La/b/c;", null, null ) );
365 
366         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
367     }
368 
369     @Test
370     public void testVisitMethodWithException()
371     {
372         // void a() throws a.b.c
373         assertVisitor( visitor.visitMethod( 0, "a", "()V", null, new String[] { "a/b/c" } ) );
374 
375         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
376     }
377 
378     @Test
379     public void testVisitMethodWithExceptions()
380     {
381         // void a() throws a.b.c, x.y.z
382         assertVisitor( visitor.visitMethod( 0, "a", "()V", null, new String[] { "a/b/c", "x/y/z" } ) );
383 
384         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
385     }
386 
387     // visitAnnotationDefault tests -------------------------------------------
388 
389     @Test
390     public void testVisitAnnotationDefault()
391     {
392         assertVisitor( mv.visitAnnotationDefault() );
393         assertThat( resultCollector.getDependencies() ).isEmpty();
394     }
395 
396     // visitParameterAnnotation tests -------------------------------------------
397 
398     @Test
399     public void testVisitParameterAnnotation()
400     {
401         // @a.b.c
402         assertVisitor( mv.visitParameterAnnotation( 0, "La/b/c;", false ) );
403 
404         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
405     }
406 
407     // visitCode tests --------------------------------------------------------
408 
409     @Test
410     public void testVisitCode()
411     {
412         mv.visitCode();
413 
414         assertThat( resultCollector.getDependencies() ).isEmpty();
415     }
416 
417     // visitFrame tests -------------------------------------------------------
418 
419     @Test
420     public void testVisitFrame()
421     {
422         mv.visitFrame( Opcodes.F_NEW, 0, new Object[0], 0, new Object[0] );
423 
424         assertThat( resultCollector.getDependencies() ).isEmpty();
425     }
426 
427     // visitInsn tests --------------------------------------------------------
428 
429     @Test
430     public void testVisitInsn()
431     {
432         mv.visitInsn( Opcodes.NOP );
433 
434         assertThat( resultCollector.getDependencies() ).isEmpty();
435     }
436 
437     // visitIntInsn tests -----------------------------------------------------
438 
439     @Test
440     public void testVisitIntInsn()
441     {
442         mv.visitIntInsn( Opcodes.BIPUSH, 0 );
443 
444         assertThat( resultCollector.getDependencies() ).isEmpty();
445     }
446 
447     // visitVarInsn tests -----------------------------------------------------
448 
449     @Test
450     public void testVisitVarInsn()
451     {
452         mv.visitVarInsn( Opcodes.ILOAD, 0 );
453 
454         assertThat( resultCollector.getDependencies() ).isEmpty();
455     }
456 
457     // visitTypeInsn tests ----------------------------------------------------
458 
459     @Test
460     public void testVisitTypeInsn()
461     {
462         mv.visitTypeInsn( Opcodes.NEW, "a/b/c" );
463 
464         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
465     }
466 
467     // visitFieldInsn tests ---------------------------------------------------
468 
469     @Test
470     public void testVisitFieldInsnWithPrimitive()
471     {
472         mv.visitFieldInsn( Opcodes.GETFIELD, "a/b/c", "x", "I" );
473 
474         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
475     }
476 
477     @Test
478     public void testVisitFieldInsnWithObject()
479     {
480         mv.visitFieldInsn( Opcodes.GETFIELD, "a/b/c", "x", "Lx/y/z;" );
481 
482         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
483     }
484 
485     // visitMethodInsn tests --------------------------------------------------
486 
487     @Test
488     public void testVisitMethodInsn()
489     {
490         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()V", false );
491 
492         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
493     }
494 
495     @Test
496     public void testVisitMethodInsnWithPrimitiveArgument()
497     {
498         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "(I)V", false );
499 
500         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
501     }
502 
503     @Test
504     public void testVisitMethodInsnWithPrimitiveArrayArgument()
505     {
506         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "([I)V", false );
507 
508         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
509     }
510 
511     @Test
512     public void testVisitMethodInsnWithObjectArgument()
513     {
514         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "(Lx/y/z;)V", false );
515 
516         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
517     }
518 
519     @Test
520     public void testVisitMethodInsnWithObjectArguments()
521     {
522         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "(Lp/q/r;Lx/y/z;)V", false );
523 
524         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
525     }
526 
527     @Test
528     public void testVisitMethodInsnWithObjectArrayArgument()
529     {
530         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "([Lx/y/z;)V", false );
531 
532         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
533     }
534 
535     @Test
536     public void testVisitMethodInsnWithPrimitiveReturnType()
537     {
538         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()I", false );
539 
540         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
541     }
542 
543     @Test
544     public void testVisitMethodInsnWithPrimitiveArrayReturnType()
545     {
546         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()[I", false );
547 
548         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
549     }
550 
551     @Test
552     public void testVisitMethodInsnWithObjectReturnType()
553     {
554         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()Lx/y/z;", false );
555 
556         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
557     }
558 
559     @Test
560     public void testVisitMethodInsnWithObjectArrayReturnType()
561     {
562         mv.visitMethodInsn( Opcodes.INVOKEVIRTUAL, "a/b/c", "x", "()[Lx/y/z;", false );
563 
564         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
565     }
566 
567     // visitJumpInsn tests ----------------------------------------------------
568 
569     @Test
570     public void testVisitJumpInsn()
571     {
572         mv.visitJumpInsn( Opcodes.IFEQ, new Label() );
573 
574         assertThat( resultCollector.getDependencies() ).isEmpty();
575     }
576 
577     // visitLabel tests -------------------------------------------------------
578 
579     @Test
580     public void testVisitLabel()
581     {
582         mv.visitLabel( new Label() );
583 
584         assertThat( resultCollector.getDependencies() ).isEmpty();
585     }
586 
587     // visitLdcInsn tests -----------------------------------------------------
588 
589     @Test
590     public void testVisitLdcInsnWithNonType()
591     {
592         mv.visitLdcInsn( "a" );
593 
594         assertThat( resultCollector.getDependencies() ).isEmpty();
595     }
596 
597     @Test
598     public void testVisitLdcInsnWithPrimitiveType()
599     {
600         mv.visitLdcInsn( Type.INT_TYPE );
601 
602         assertThat( resultCollector.getDependencies() ).isEmpty();
603     }
604 
605     @Test
606     public void testVisitLdcInsnWithObjectType()
607     {
608         mv.visitLdcInsn( Type.getType( "La/b/c;" ) );
609 
610         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
611     }
612 
613     // visitIincInsn tests ----------------------------------------------------
614 
615     @Test
616     public void testVisitIincInsn()
617     {
618         mv.visitIincInsn( 0, 1 );
619 
620         assertThat( resultCollector.getDependencies() ).isEmpty();
621     }
622 
623     // visitTableSwitchInsn tests ---------------------------------------------
624 
625     @Test
626     public void testVisitTableSwitchInsn()
627     {
628         mv.visitTableSwitchInsn( 0, 1, new Label(), new Label() );
629 
630         assertThat( resultCollector.getDependencies() ).isEmpty();
631     }
632 
633     // visitLookupSwitchInsn tests --------------------------------------------
634 
635     @Test
636     public void testVisitLookupSwitchInsn()
637     {
638         mv.visitLookupSwitchInsn( new Label(), new int[] { 0 }, new Label[] { new Label() } );
639 
640         assertThat( resultCollector.getDependencies() ).isEmpty();
641     }
642 
643     // visitMultiANewArrayInsn tests ------------------------------------------
644 
645     @Test
646     public void testVisitMultiANewArrayInsnWithPrimitive()
647     {
648         mv.visitMultiANewArrayInsn( "I", 2 );
649 
650         assertThat( resultCollector.getDependencies() ).isEmpty();
651     }
652 
653     @Test
654     public void testVisitMultiANewArrayInsnWithObject()
655     {
656         mv.visitMultiANewArrayInsn( "La/b/c;", 2 );
657 
658         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
659     }
660 
661     // visitTryCatchBlock tests -----------------------------------------------
662 
663     @Test
664     public void testVisitTryCatchBlock()
665     {
666         mv.visitTryCatchBlock( new Label(), new Label(), new Label(), "a/b/c" );
667 
668         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
669     }
670 
671     @Test
672     public void testVisitTryCatchBlockForFinally()
673     {
674         mv.visitTryCatchBlock( new Label(), new Label(), new Label(), null );
675 
676         assertThat( resultCollector.getDependencies() ).isEmpty();
677     }
678 
679     // visitLocalVariable tests -----------------------------------------------
680 
681     @Test
682     public void testVisitLocalVariableWithPrimitive()
683     {
684         mv.visitLocalVariable( "a", "I", null, new Label(), new Label(), 0 );
685 
686         assertThat( resultCollector.getDependencies() ).isEmpty();
687     }
688 
689     @Test
690     public void testVisitLocalVariableWithPrimitiveArray()
691     {
692         mv.visitLocalVariable( "a", "[I", null, new Label(), new Label(), 0 );
693 
694         assertThat( resultCollector.getDependencies() ).isEmpty();
695     }
696 
697     @Test
698     public void testVisitLocalVariableWithObject()
699     {
700         mv.visitLocalVariable( "a", "La/b/c;", null, new Label(), new Label(), 0 );
701 
702         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
703     }
704 
705     @Test
706     public void testVisitLocalVariableWithObjectArray()
707     {
708         mv.visitLocalVariable( "a", "[La/b/c;", null, new Label(), new Label(), 0 );
709 
710         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c" );
711     }
712 
713     @Test
714     public void testVisitLocalVariableWithGenericObject()
715     {
716         mv.visitLocalVariable( "a", "La/b/c;", "La/b/c<Lx/y/z;>;", new Label(), new Label(), 0 );
717 
718         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
719     }
720 
721     @Test
722     public void testVisitLocalVariableWithGenericObjectArray()
723     {
724         mv.visitLocalVariable( "a", "La/b/c;", "[La/b/c<Lx/y/z;>;", new Label(), new Label(), 0 );
725 
726         assertThat( resultCollector.getDependencies() ).containsOnly( "a.b.c", "x.y.z" );
727     }
728 
729     // visitLineNumber tests --------------------------------------------------
730 
731     @Test
732     public void testVisitLineNumber()
733     {
734         mv.visitLineNumber( 0, new Label() );
735 
736         assertThat( resultCollector.getDependencies() ).isEmpty();
737     }
738 
739     // visitMaxs tests --------------------------------------------------------
740 
741     @Test
742     public void testVisitMaxs()
743     {
744         mv.visitMaxs( 0, 0 );
745 
746         assertThat( resultCollector.getDependencies() ).isEmpty();
747     }
748 
749     private void assertVisitor( Object actualVisitor )
750     {
751         //assertEquals( visitor, actualVisitor );
752     }
753 
754     /**
755      * A simple ASM <code>Attribute</code> for use in tests.
756      *
757      * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
758      */
759     static class MockAttribute extends Attribute
760     {
761         public MockAttribute( String type )
762         {
763             super( type );
764         }
765     }
766 }