Skip to content

Commit

Permalink
Fix codelet no output test
Browse files Browse the repository at this point in the history
Issue CST-Group#64 solved
  • Loading branch information
EltonCN committed Nov 28, 2024
1 parent deb39d9 commit 0b9a4aa
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/test/java/br/unicamp/cst/core/entities/CodeletTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,29 @@ public void getOutputNullReturnTest(){
public void getOutputEnableFalseTest(){
boolean exceptionThrown = false;
Codelet testCodelet = null;
try {
testCodelet = generateCodelet();
testCodelet.setName("thisCodeletWillFail");
List<Memory> dummyOutputs = Arrays.asList(new MemoryObject(), new MemoryObject());
testCodelet.setOutputs(dummyOutputs);


testCodelet.getOutput("testType", 3); // This line will raise an exception

Mind mind = new Mind();
mind.insertCodelet(testCodelet);
mind.start();
//
Thread.sleep(1000);
// } catch (Exception e) {
// e.printStackTrace();
// }
mind.shutDown();
} catch (Exception e) {
// why this exception is not being thrown ?
System.out.println("Passei aqui");
exceptionThrown = true;


Memory output = testCodelet.getOutput("testType", 3);
assertNull(output);

Mind mind = new Mind();
mind.insertCodelet(testCodelet);
mind.start();
try{
Thread.sleep(1000);
}
catch (InterruptedException e)
{

}
//assertTrue(exceptionThrown); If I uncomment this line, the test fails ... for some reason the exception is not being caught


mind.shutDown();

assertFalse(testCodelet.getEnabled());
testCodelet.setEnabled(true);
assertTrue(testCodelet.getEnabled());
Expand Down

0 comments on commit 0b9a4aa

Please sign in to comment.