|
| 1 | +/* |
| 2 | + * @cond LICENSE |
| 3 | + * ###################################################################################### |
| 4 | + * # LGPL License # |
| 5 | + * # # |
| 6 | + * # This file is part of the LightJason AgentSpeak(L++) # |
| 7 | + * # Copyright (c) 2015-19, LightJason (info@lightjason.org) # |
| 8 | + * # This program is free software: you can redistribute it and/or modify # |
| 9 | + * # it under the terms of the GNU Lesser General Public License as # |
| 10 | + * # published by the Free Software Foundation, either version 3 of the # |
| 11 | + * # License, or (at your option) any later version. # |
| 12 | + * # # |
| 13 | + * # This program is distributed in the hope that it will be useful, # |
| 14 | + * # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
| 15 | + * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
| 16 | + * # GNU Lesser General Public License for more details. # |
| 17 | + * # # |
| 18 | + * # You should have received a copy of the GNU Lesser General Public License # |
| 19 | + * # along with this program. If not, see http://www.gnu.org/licenses/ # |
| 20 | + * ###################################################################################### |
| 21 | + * @endcond |
| 22 | + */ |
| 23 | + |
| 24 | +package org.lightjason.agentspeak.testing; |
| 25 | + |
| 26 | +import org.junit.Assert; |
| 27 | +import org.junit.Test; |
| 28 | +import org.lightjason.agentspeak.action.IAction; |
| 29 | +import org.lightjason.agentspeak.common.CCommon; |
| 30 | + |
| 31 | +import javax.annotation.Nonnull; |
| 32 | +import java.util.Locale; |
| 33 | + |
| 34 | + |
| 35 | +/** |
| 36 | + * action name tests |
| 37 | + */ |
| 38 | +public final class TestCActionNames |
| 39 | +{ |
| 40 | + |
| 41 | + /** |
| 42 | + * run test |
| 43 | + */ |
| 44 | + @Test |
| 45 | + public void actionnames() |
| 46 | + { |
| 47 | + CCommon.actionsFromPackage().parallel().forEach( TestCActionNames::checkname ); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * check action name |
| 52 | + * |
| 53 | + * @param p_action action |
| 54 | + */ |
| 55 | + private static void checkname( @Nonnull final IAction p_action ) |
| 56 | + { |
| 57 | + Assert.assertTrue( |
| 58 | + p_action.getClass().getCanonicalName(), |
| 59 | + p_action.name().toString().contains( p_action.getClass().getSimpleName().substring( 1 ).toLowerCase( Locale.ROOT ) ) |
| 60 | + ); |
| 61 | + } |
| 62 | + |
| 63 | +} |
0 commit comments