24 package org.lightjason.agentspeak.action.builtin;
    26 import org.junit.Assert;
    27 import org.junit.Test;
    37 import java.io.ByteArrayOutputStream;
    38 import java.io.PrintStream;
    39 import java.util.ArrayList;
    40 import java.util.Collections;
    41 import java.util.List;
    42 import java.util.stream.Collectors;
    43 import java.util.stream.Stream;
    60             Stream.of( 
true, 
"test message" ).map( 
CRawTerm::from ).collect( Collectors.toList() ),
    61             Collections.emptyList()
    74             Stream.of( 
true ).map( 
CRawTerm::from ).collect( Collectors.toList() ),
    75             Collections.emptyList()
    88             Stream.of( 
false, 
"this should not be thrown" ).map( 
CRawTerm::from ).collect( Collectors.toList() ),
    89             Collections.emptyList()
   100     public final void print() throws Exception
   102         final ByteArrayOutputStream l_output = 
new ByteArrayOutputStream();
   104         new CPrint( () -> 
new PrintStream( l_output, 
false, 
"utf-8" ), 
"-" ).
execute(
   106             Stream.of( 
"foobar", 1234, 
true ).map( 
CRawTerm::from ).collect( Collectors.toList() ),
   107             Collections.emptyList()
   110         Assert.assertEquals( l_output.toString( 
"utf-8" ), 
"foobar-1234-true\n" );
   124         Assert.assertFalse( l_format1.equals( l_format2 ) );
   127         final ByteArrayOutputStream l_output = 
new ByteArrayOutputStream();
   128         final CPrint l_print = 
new CPrint( () -> 
new PrintStream( l_output, 
false, 
"utf-8" ), 
"-" );
   135             Stream.of( 
"foobar", 1234, 
true ).map( 
CRawTerm::from ).collect( Collectors.toList() ),
   136             Collections.emptyList()
   139         Assert.assertEquals( l_output.toString( 
"utf-8" ), 
"FOOBAR-1234-yes\n" );
   148         final List<ITerm> l_return = 
new ArrayList<>();
   152             Collections.emptyList(),
   156         Assert.assertEquals( l_return.size(), 1 );
   157         Assert.assertEquals( l_return.get( 0 ).raw().getClass(), String.class );
   158         Assert.assertTrue( !l_return.get( 0 ).<String>raw().isEmpty() );
   180         protected final String 
format( 
final String p_data )
   182             return p_data.toUpperCase();
   199             return Boolean.class;
   203         protected final String 
format( 
final Boolean p_data )
   205             return p_data ? 
"yes" : 
"no";
 final void uuid()
test single uuid 
 
final void printformatter()
test print action with formatter 
 
final void throwwithoutparameter()
test throw action 
 
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation 
 
base test class with helpers 
 
IContext EMPTYPLAN
empty context with plan 
 
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation 
 
action for throwing a runtime execption. 
 
execution context with local data 
 
final Set< IFormatter<?> > formatter()
returns the formatter list 
 
action for sum of elements. 
 
final void thrownot()
test throw without throwing 
 
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term 
 
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation 
 
final void print()
test print action 
 
term structure for simple datatypes 
 
final void throwparameter()
test throw action