LightVoting
 All Classes Namespaces Files Functions Variables Pages
org.lightvoting.simulation.agent.CVotingAgentGeneratorTest Class Reference

Unit test for CVotingAgentGenerator. More...

Inherits TestCase.

+ Collaboration diagram for org.lightvoting.simulation.agent.CVotingAgentGeneratorTest:

Public Member Functions

 CVotingAgentGeneratorTest (final String p_testName)
 Create the test case. More...
 
void testCVotingAgent ()
 Testing CVotingAgent Class. More...
 

Static Public Member Functions

static Test suite ()
 Testsuite. More...
 

Detailed Description

Definition at line 43 of file CVotingAgentGeneratorTest.java.

Constructor & Destructor Documentation

org.lightvoting.simulation.agent.CVotingAgentGeneratorTest.CVotingAgentGeneratorTest ( final String  p_testName)
Parameters
p_testNamename of the test case

Definition at line 50 of file CVotingAgentGeneratorTest.java.

51  {
52  super( p_testName );
53  }

Member Function Documentation

static Test org.lightvoting.simulation.agent.CVotingAgentGeneratorTest.suite ( )
static
Returns
the suite of tests being tested

Definition at line 60 of file CVotingAgentGeneratorTest.java.

61  {
62  return new TestSuite( CVotingAgentGeneratorTest.class );
63  }
CVotingAgentGeneratorTest(final String p_testName)
Create the test case.
void org.lightvoting.simulation.agent.CVotingAgentGeneratorTest.testCVotingAgent ( )

Definition at line 68 of file CVotingAgentGeneratorTest.java.

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  }