PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/test/java/com/google/test/metric/asm/MethodVisitorBuilderTest.java

http://testability-explorer.googlecode.com/
Java | 45 lines | 23 code | 7 blank | 15 comment | 0 complexity | 3bc077a636230ecb22afb77c62eb82ba MD5 | raw file
 1/*
 2 * Copyright 2007 Google Inc.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package com.google.test.metric.asm;
17
18import junit.framework.TestCase;
19
20import org.objectweb.asm.Opcodes;
21
22import com.google.test.metric.ClassInfo;
23import com.google.test.metric.Visibility;
24
25public class MethodVisitorBuilderTest extends TestCase {
26
27  public void testSwap() throws Exception {
28    ClassInfo classInfo = new ClassInfo("TestClass", false, null, null, null);
29    MethodVisitorBuilder builder = new MethodVisitorBuilder(null , classInfo , "test",
30        "()V", null, null, true, false, Visibility.PUBLIC);
31    builder.visitInsn(Opcodes.ICONST_0);
32    builder.visitInsn(Opcodes.ICONST_0);
33    builder.visitInsn(Opcodes.SWAP);
34    builder.visitEnd();
35  }
36
37  public void testNoop() throws Exception {
38    ClassInfo classInfo = new ClassInfo("TestClass", false, null, null, null);
39    MethodVisitorBuilder builder = new MethodVisitorBuilder(null , classInfo , "test",
40        "()V", null, null, true, false, Visibility.PUBLIC);
41    builder.visitInsn(Opcodes.NOP);
42    builder.visitEnd();
43  }
44
45}