You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Java16PreviewFeaturesTests.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*******************************************************************************
  2. * Copyright (c) 2021 Contributors
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *******************************************************************************/
  8. package org.aspectj.systemtest.ajc197;
  9. import junit.framework.Test;
  10. import org.aspectj.apache.bcel.Constants;
  11. import org.aspectj.testing.XMLBasedAjcTestCase;
  12. import org.aspectj.testing.XMLBasedAjcTestCaseForJava16Only;
  13. /**
  14. * @author Alexander Kriegisch
  15. */
  16. public class Java16PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava16Only {
  17. private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(16);
  18. public void testSealedClassWithLegalSubclasses() {
  19. runTest("sealed class with legal subclasses");
  20. checkVersion("Employee", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  21. checkVersion("Manager", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  22. }
  23. public void testSealedClassWithIllegalSubclass() {
  24. runTest("sealed class with illegal subclass");
  25. checkVersion("Person", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  26. }
  27. public void testWeaveSealedClass() {
  28. runTest("weave sealed class");
  29. checkVersion("PersonAspect", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  30. }
  31. public static Test suite() {
  32. return XMLBasedAjcTestCase.loadSuite(Java16PreviewFeaturesTests.class);
  33. }
  34. @Override
  35. protected java.net.URL getSpecFile() {
  36. return getClassResource("ajc197.xml");
  37. }
  38. }