001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bct.junit;
018
019/**
020 * Lifecycle scope for a {@link TestBean @TestBean}-declared override.
021 *
022 * <p>
023 * Selects whether the override is rebuilt on every test method ({@link #METHOD}) or shared across all test
024 * methods in a single test class ({@link #CLASS}).
025 *
026 * <h5 class='section'>See Also:</h5><ul>
027 *    <li class='ja'>{@link TestBean} - The annotation that carries this scope.
028 *    <li class='jc'>{@link JuneauBeanStoreExtension} - The JUnit 5 extension that honors this scope.
029 * </ul>
030 *
031 * @since 10.0.0
032 */
033public enum Scope {
034
035   /**
036    * Per-test scope &mdash; the override is rebuilt for every {@code @Test} method.
037    *
038    * <p>
039    * Default scope.  Discovered at {@code beforeEach} and dropped at {@code afterEach}.
040    */
041   METHOD,
042
043   /**
044    * Per-class scope &mdash; the override is built once and shared by every {@code @Test} method in the class.
045    *
046    * <p>
047    * Discovered at {@code beforeAll} and dropped at {@code afterAll}.  Only {@code static} fields and methods may
048    * declare {@code CLASS}-scope overrides; instance members are not visible at {@code beforeAll} time.
049    */
050   CLASS
051}