/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. */
  16. package com.google.test.metric.asm;
  17. import junit.framework.TestCase;
  18. import org.objectweb.asm.Opcodes;
  19. import com.google.test.metric.ClassInfo;
  20. import com.google.test.metric.Visibility;
  21. public class MethodVisitorBuilderTest extends TestCase {
  22. public void testSwap() throws Exception {
  23. ClassInfo classInfo = new ClassInfo("TestClass", false, null, null, null);
  24. MethodVisitorBuilder builder = new MethodVisitorBuilder(null , classInfo , "test",
  25. "()V", null, null, true, false, Visibility.PUBLIC);
  26. builder.visitInsn(Opcodes.ICONST_0);
  27. builder.visitInsn(Opcodes.ICONST_0);
  28. builder.visitInsn(Opcodes.SWAP);
  29. builder.visitEnd();
  30. }
  31. public void testNoop() throws Exception {
  32. ClassInfo classInfo = new ClassInfo("TestClass", false, null, null, null);
  33. MethodVisitorBuilder builder = new MethodVisitorBuilder(null , classInfo , "test",
  34. "()V", null, null, true, false, Visibility.PUBLIC);
  35. builder.visitInsn(Opcodes.NOP);
  36. builder.visitEnd();
  37. }
  38. }