LightVoting
 All Classes Namespaces Files Functions Variables Pages
CVotingAgentGeneratorTest.java
Go to the documentation of this file.
1 
24 package org.lightvoting.simulation.agent;
25 
26 
27 import junit.framework.Test;
28 import junit.framework.TestCase;
29 import junit.framework.TestSuite;
30 import org.lightjason.agentspeak.agent.IAgent;
33 
34 import java.io.ByteArrayInputStream;
35 import java.io.InputStream;
36 import java.util.Set;
37 import java.util.stream.Collectors;
38 
39 
43 public final class CVotingAgentGeneratorTest extends TestCase
44 {
50  public CVotingAgentGeneratorTest( final String p_testName )
51  {
52  super( p_testName );
53  }
54 
60  public static Test suite()
61  {
62  return new TestSuite( CVotingAgentGeneratorTest.class );
63  }
64 
68  public void testCVotingAgent()
69  {
70  try
71  {
72  final InputStream l_aslstream = new ByteArrayInputStream(
73  "!main.\n+!main.".getBytes( "UTF-8" )
74  );
75 
76  final CSend l_sendaction = new CSend();
77 
78  /* TODO Check test */
79  final Set<CVotingAgent> l_agents = new
80 
81  CVotingAgent.CVotingAgentGenerator( l_sendaction, l_aslstream, new CEnvironment( 23, "foo.h5" ), 10, "RANDOM", "foo.h5" )
82  .generatemultiple( 23, new CChairAgent.CChairAgentGenerator( l_aslstream, new CEnvironment( 23, "foo.h5" ), "RANDOM", "BASIC",
83  "foo.h5"
84  ) )
85  .collect( Collectors.toSet() );
86 
87  assertEquals( 23, l_agents.size() );
88 
89  l_agents.forEach( i ->
90  {
91  assertTrue( i instanceof CVotingAgent );
92  assertTrue( i instanceof IAgent );
93  } );
94  }
95  catch ( final Exception l_exception )
96  {
97  l_exception.printStackTrace();
98  return;
99  }
100  }
101 }
102 
CVotingAgentGeneratorTest(final String p_testName)
Create the test case.
Created by sophie on 21.02.17.
Action to send messages for communication.
Definition: CSend.java:49
BDI agent with voting capabilities.