Java Code Examples for net.bytebuddy.description.modifier.Visibility#PUBLIC
The following examples show how to use
net.bytebuddy.description.modifier.Visibility#PUBLIC .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 6 votes |
@Test public void testDefinedMethodWithParameters() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithoutBody(methodDescription, methodAttributeAppender, Visibility.PUBLIC); assertThat(record.getSort(), is(TypeWriter.MethodPool.Record.Sort.DEFINED)); record.apply(classVisitor, implementationContext, annotationValueFilterFactory); verify(classVisitor).visitMethod(MODIFIERS, FOO, BAR, QUX, new String[]{BAZ}); verifyNoMoreInteractions(classVisitor); verify(methodVisitor).visitParameter(FOO, MODIFIERS); verify(methodVisitor).visitEnd(); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); verifyNoMoreInteractions(methodAttributeAppender); }
Example 2
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 6 votes |
@Test public void testImplementedMethod() throws Exception { TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody(methodDescription, byteCodeAppender, methodAttributeAppender, Visibility.PUBLIC); assertThat(record.getSort(), is(TypeWriter.MethodPool.Record.Sort.IMPLEMENTED)); record.apply(classVisitor, implementationContext, annotationValueFilterFactory); verify(classVisitor).visitMethod(MODIFIERS, FOO, BAR, QUX, new String[]{BAZ}); verifyNoMoreInteractions(classVisitor); verify(methodVisitor).visitCode(); verify(methodVisitor).visitMaxs(ONE, TWO); verify(methodVisitor).visitEnd(); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); verifyNoMoreInteractions(methodAttributeAppender); verify(byteCodeAppender).apply(methodVisitor, implementationContext, methodDescription); verifyNoMoreInteractions(byteCodeAppender); }
Example 3
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 6 votes |
@Test public void testImplementedMethodBodyOnly() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody(methodDescription, byteCodeAppender, methodAttributeAppender, Visibility.PUBLIC); record.applyBody(methodVisitor, implementationContext, annotationValueFilterFactory); verify(methodVisitor).visitCode(); verify(methodVisitor).visitMaxs(ONE, TWO); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); verifyNoMoreInteractions(methodAttributeAppender); verify(byteCodeAppender).apply(methodVisitor, implementationContext, methodDescription); verifyNoMoreInteractions(byteCodeAppender); }
Example 4
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 6 votes |
@Test public void testImplementedMethodWithParameters() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody(methodDescription, byteCodeAppender, methodAttributeAppender, Visibility.PUBLIC); assertThat(record.getSort(), is(TypeWriter.MethodPool.Record.Sort.IMPLEMENTED)); record.apply(classVisitor, implementationContext, annotationValueFilterFactory); verify(classVisitor).visitMethod(MODIFIERS, FOO, BAR, QUX, new String[]{BAZ}); verifyNoMoreInteractions(classVisitor); verify(methodVisitor).visitParameter(FOO, MODIFIERS); verify(methodVisitor).visitCode(); verify(methodVisitor).visitMaxs(ONE, TWO); verify(methodVisitor).visitEnd(); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); verifyNoMoreInteractions(methodAttributeAppender); verify(byteCodeAppender).apply(methodVisitor, implementationContext, methodDescription); verifyNoMoreInteractions(byteCodeAppender); }
Example 5
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testDefinedMethod() throws Exception { TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithoutBody(methodDescription, methodAttributeAppender, Visibility.PUBLIC); assertThat(record.getSort(), is(TypeWriter.MethodPool.Record.Sort.DEFINED)); record.apply(classVisitor, implementationContext, annotationValueFilterFactory); verify(classVisitor).visitMethod(MODIFIERS, FOO, BAR, QUX, new String[]{BAZ}); verifyNoMoreInteractions(classVisitor); verify(methodVisitor).visitEnd(); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); verifyNoMoreInteractions(methodAttributeAppender); }
Example 6
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testDefinedMethodHeadOnly() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithoutBody(methodDescription, methodAttributeAppender, Visibility.PUBLIC); record.applyHead(methodVisitor); verifyZeroInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verifyZeroInteractions(methodAttributeAppender); }
Example 7
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testDefinedMethodBodyOnly() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithoutBody(methodDescription, methodAttributeAppender, Visibility.PUBLIC); record.applyBody(methodVisitor, implementationContext, annotationValueFilterFactory); verifyZeroInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verify(methodAttributeAppender).apply(methodVisitor, methodDescription, annotationValueFilter); }
Example 8
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testImplementedMethodHeadOnly() throws Exception { when(parameterDescription.hasModifiers()).thenReturn(true); when(parameterDescription.isNamed()).thenReturn(true); TypeWriter.MethodPool.Record record = new TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody(methodDescription, byteCodeAppender, methodAttributeAppender, Visibility.PUBLIC); record.applyHead(methodVisitor); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); verifyZeroInteractions(methodAttributeAppender); verifyZeroInteractions(byteCodeAppender); }
Example 9
Source File: TypeWriterMethodPoolRecordTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testAccessorBridgePrependingTakesDelegateVisibility() throws Exception { Visibility visibility = Visibility.PUBLIC; when(delegate.getVisibility()).thenReturn(visibility); assertThat(new TypeWriter.MethodPool.Record.AccessBridgeWrapper(delegate, instrumentedType, bridgeTarget, Collections.singleton(typeToken), methodAttributeAppender).getVisibility(), is(visibility)); }