/test/kilim/test/TestInvalidPausables.java

http://github.com/kilim/kilim · Java · 60 lines · 46 code · 9 blank · 5 comment · 1 complexity · 554e529e9488b59d6c3ae3cf87ff20d2 MD5 · raw file

  1. /* Copyright (c) 2006, Sriram Srinivasan
  2. *
  3. * You may distribute this software under the terms of the license
  4. * specified in the file "License"
  5. */
  6. package kilim.test;
  7. import junit.framework.TestCase;
  8. import kilim.KilimException;
  9. import kilim.WeavingClassLoader;
  10. public class TestInvalidPausables extends TestCase {
  11. private static boolean debug = false;
  12. private void ensureException(String className) {
  13. try {
  14. new WeavingClassLoader().weaveClass(className);
  15. fail("Expected weave exception while processing " + className);
  16. } catch (KilimException ke) {
  17. if (debug) System.out.println(ke);
  18. } catch (Exception e) {
  19. fail(e.toString());
  20. }
  21. }
  22. public void testWeaveConstructor() {
  23. ensureException("kilim.test.ex.ExInvalidConstructor");
  24. ensureException("kilim.test.ex.ExInvalidConstructor2");
  25. ensureException("kilim.test.ex.ExInvalidConstructor3");
  26. }
  27. public void testWeaveSynchronized() {
  28. ensureException("kilim.test.ex.ExInvalidSynchronized");
  29. ensureException("kilim.test.ex.ExInvalidSynchronized1");
  30. }
  31. public void testWeaveStatic() {
  32. ensureException("kilim.test.ex.ExInvalidStaticBlock");
  33. }
  34. public void testWeaveMethod() {
  35. ensureException("kilim.test.ex.ExInvalidCallP_NP");
  36. }
  37. public void testWeaveSuperPausable() {
  38. ensureException("kilim.test.ex.ExInvalidNPDerived");
  39. }
  40. public void testWeaveSuperNotPausable() {
  41. ensureException("kilim.test.ex.ExInvalidPDerived");
  42. }
  43. public void testWeaveInterfacePausable() {
  44. ensureException("kilim.test.ex.ExInvalidPImp");
  45. ensureException("kilim.test.ex.ExInvalidPFace");
  46. }
  47. public void testWeaveInterfaceNotPausable() {
  48. ensureException("kilim.test.ex.ExInvalidNPImp");
  49. ensureException("kilim.test.ex.ExInvalidNPFace");
  50. }
  51. }