@@ -149,4 +149,121 @@ public void testStackCanUnderflow() throws Exception {
149
149
verify (this .methodVisitor ).visitInsn (Opcodes .POP );
150
150
verifyNoMoreInteractions (this .methodVisitor );
151
151
}
152
- }
152
+
153
+ @ Test
154
+ public void testStackFrameSame () {
155
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
156
+ methodVisitor .visitFrame (Opcodes .F_SAME , 0 , null , 0 , null );
157
+ methodVisitor .drainStack ();
158
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_SAME , 0 , null , 0 , null );
159
+ verifyNoMoreInteractions (this .methodVisitor );
160
+ }
161
+
162
+ @ Test
163
+ public void testStackFrameChop () {
164
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
165
+ methodVisitor .visitFrame (Opcodes .F_CHOP , 0 , null , 0 , null );
166
+ methodVisitor .drainStack ();
167
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_CHOP , 0 , null , 0 , null );
168
+ verifyNoMoreInteractions (this .methodVisitor );
169
+ }
170
+
171
+ @ Test
172
+ public void testStackFrameAppend () {
173
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
174
+ methodVisitor .visitFrame (Opcodes .F_APPEND , 0 , null , 0 , null );
175
+ methodVisitor .drainStack ();
176
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_APPEND , 0 , null , 0 , null );
177
+ verifyNoMoreInteractions (this .methodVisitor );
178
+ }
179
+
180
+ @ Test
181
+ public void testStackFrameSame1OnInteger () {
182
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
183
+ methodVisitor .visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
184
+ methodVisitor .drainStack ();
185
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
186
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP );
187
+ verifyNoMoreInteractions (this .methodVisitor );
188
+ }
189
+
190
+ @ Test
191
+ public void testStackFrameSame1OnLong () {
192
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
193
+ methodVisitor .visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .LONG });
194
+ methodVisitor .drainStack ();
195
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .LONG });
196
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
197
+ verifyNoMoreInteractions (this .methodVisitor );
198
+ }
199
+
200
+ @ Test
201
+ public void testStackFrameSame1OnDouble () {
202
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
203
+ methodVisitor .visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
204
+ methodVisitor .drainStack ();
205
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_SAME1 , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
206
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
207
+ verifyNoMoreInteractions (this .methodVisitor );
208
+ }
209
+
210
+ @ Test
211
+ public void testStackFrameFullOnInteger () {
212
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
213
+ methodVisitor .visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
214
+ methodVisitor .drainStack ();
215
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
216
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP );
217
+ verifyNoMoreInteractions (this .methodVisitor );
218
+ }
219
+
220
+ @ Test
221
+ public void testStackFrameFullOnLong () {
222
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
223
+ methodVisitor .visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .LONG });
224
+ methodVisitor .drainStack ();
225
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .LONG });
226
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
227
+ verifyNoMoreInteractions (this .methodVisitor );
228
+ }
229
+
230
+ @ Test
231
+ public void testStackFrameFullOnDouble () {
232
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
233
+ methodVisitor .visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
234
+ methodVisitor .drainStack ();
235
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_FULL , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
236
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
237
+ verifyNoMoreInteractions (this .methodVisitor );
238
+ }
239
+
240
+ @ Test
241
+ public void testStackFrameNewOnInteger () {
242
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
243
+ methodVisitor .visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
244
+ methodVisitor .drainStack ();
245
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .INTEGER });
246
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP );
247
+ verifyNoMoreInteractions (this .methodVisitor );
248
+ }
249
+
250
+ @ Test
251
+ public void testStackFrameNewOnLong () {
252
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
253
+ methodVisitor .visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .LONG });
254
+ methodVisitor .drainStack ();
255
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .LONG });
256
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
257
+ verifyNoMoreInteractions (this .methodVisitor );
258
+ }
259
+
260
+ @ Test
261
+ public void testStackFrameNewOnDouble () {
262
+ StackAwareMethodVisitor methodVisitor = new StackAwareMethodVisitor (this .methodVisitor , methodDescription );
263
+ methodVisitor .visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
264
+ methodVisitor .drainStack ();
265
+ verify (this .methodVisitor ).visitFrame (Opcodes .F_NEW , 0 , null , 1 , new Object [] {Opcodes .DOUBLE });
266
+ verify (this .methodVisitor ).visitInsn (Opcodes .POP2 );
267
+ verifyNoMoreInteractions (this .methodVisitor );
268
+ }
269
+ }
0 commit comments