001/* 002 * Units of Measurement TCK 003 * Copyright © 2005-2017, Jean-Marie Dautelle, Werner Keil, V2COM. 004 * 005 * All rights reserved. 006 * 007 * Redistribution and use in source and binary forms, with or without modification, 008 * are permitted provided that the following conditions are met: 009 * 010 * 1. Redistributions of source code must retain the above copyright notice, 011 * this list of conditions and the following disclaimer. 012 * 013 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions 014 * and the following disclaimer in the documentation and/or other materials provided with the distribution. 015 * 016 * 3. Neither the name of JSR-385 nor the names of its contributors may be used to endorse or promote products 017 * derived from this software without specific prior written permission. 018 * 019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 021 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 023 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 026 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 028 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 */ 030package tech.units.tck.util; 031 032import static tech.units.tck.util.TestGroups.Group.*; 033 034import tech.uom.lib.common.function.DescriptionSupplier; 035 036/** 037 * TestNG groups and profiles used in the JSR 385 TCK. 038 * 039 * @author <a href="mailto:units@catmedia.us">Werner Keil</a> 040 * @version 1.1, April 1, 2018 041 * @since 1.0 042 */ 043public final class TestGroups { 044 045 /** 046 * TestNG groups used in the JSR 385 TCK. 047 * 048 * The most important groups (used by {@link TCKRunner}) are: 049 * <ul> 050 * <li>{@link #core} - used to include tests for the core elements of the 051 * API. These tests are <b>mandatory</b> in every profile.</li> 052 * <li>{@link #format} - formatting tests used to include elements in 053 * <tt>javax.measure.format</tt>.</li> 054 * <li>{@link #base_quantity} - tests to include <b>base quantities</b> in 055 * <tt>javax.measure.quantity</tt>.</li> 056 * <li>{@link #derived_quantity} - tests to include other quantities in 057 * <tt>javax.measure.quantity</tt>.</li> 058 * <li>{@link #spi} - tests to include SPI elements in 059 * <tt>javax.measure.spi</tt>.</li> 060 * </ul> 061 * 062 * @author Werner Keil 063 * @version 1.0.1 064 * @since 1.0 065 */ 066 public enum Group { 067 core, format, base_quantity, derived_quantity, spi 068 } 069 070 /** 071 * Minimal groups 072 */ 073 private static final Group[] MINIMAL_GROUPS = { core }; 074 075 /** 076 * Format groups 077 */ 078 private static final Group[] FORMAT_GROUPS = { core, format }; 079 080 /** 081 * Base Quantity groups 082 */ 083 private static final Group[] BASE_QUANTITY_GROUPS = { core, base_quantity }; 084 085 /** 086 * Quantity groups 087 */ 088 private static final Group[] QUANTITY_GROUPS = { core, base_quantity, 089 derived_quantity }; 090 091 /** 092 * Quantity groups and Format 093 */ 094 private static final Group[] QUANTITY_GROUPS_AND_FORMAT = { core, format, 095 base_quantity, derived_quantity }; 096 097 /** 098 * SPI groups 099 */ 100 private static final Group[] SPI_GROUPS = { core, format, spi }; 101 102 /** 103 * Profiles used in the JSR 385 TCK. 104 * 105 * The most important profiles (used by {@link TCKRunner}) are: 106 * <ul> 107 * <li>{@link #MINIMAL} - used to include tests for the core elements of the 108 * API. These tests are <b>mandatory</b> for every implementation.</li> 109 * <li>{@link #FORMAT} - formatting tests used to include tests for elements 110 * in <tt>javax.measure.format</tt>.</li> 111 * <li>{@link #FULL} - All tests in the JSR 385 TCK.</li> 112 * </ul> 113 * 114 * @author Werner Keil 115 * @version 1.0.1 116 * @since 1.0 117 */ 118 public enum Profile implements DescriptionSupplier { 119 MINIMAL("Minimal", MINIMAL_GROUPS), FORMAT("Format", FORMAT_GROUPS), BASE_QUANTITY( 120 "Base Quantity", BASE_QUANTITY_GROUPS), QUANTITY("Quantity", 121 QUANTITY_GROUPS), QUANTITY_FORMAT("Quantity and Format", 122 QUANTITY_GROUPS_AND_FORMAT), SPI("SPI", SPI_GROUPS, false), FULL( 123 "Full", Group.values(), true); 124 125 private final String description; 126 private final Group[] groups; 127 private final boolean isDefault; 128 129 private Profile(String description, Group[] groups, boolean isDefault) { 130 this.description = description; 131 this.groups = groups; 132 this.isDefault = isDefault; 133 } 134 135 private Profile(String description, Group[] groups) { 136 this(description, groups, false); 137 } 138 139 /* 140 * (non-Javadoc) 141 * 142 * @see DescriptionSupplier 143 */ 144 public String getDescription() { 145 return description; 146 } 147 148 public Group[] getGroups() { 149 return groups; 150 } 151 152 public boolean isDefault() { 153 return isDefault; 154 } 155 } 156}