1 package org.jastacry.layer;
2
3 import java.io.ByteArrayInputStream;
4 import java.io.ByteArrayOutputStream;
5 import java.io.InputStream;
6 import java.io.OutputStream;
7 import java.util.concurrent.CountDownLatch;
8
9 import org.jastacry.GlobalData.Action;
10
11 import org.junit.jupiter.api.AfterEach;
12 import org.junit.jupiter.api.BeforeEach;
13 import org.junit.jupiter.api.Test;
14
15
16
17
18
19
20
21 public class TestAbstractBasicLayer
22 {
23
24
25
26 private XorLayer layer = null;
27 private CountDownLatch endController = new CountDownLatch(1);
28 private byte[] data = {1,2,3};
29
30
31
32
33 private static final String INITVALUE = "123";
34
35
36
37
38
39
40
41 @BeforeEach
42 public void setUp() throws Exception
43 {
44 layer = new XorLayer();
45 layer.init(INITVALUE);
46 }
47
48
49
50
51
52
53
54 @AfterEach
55 public void tearDown() throws Exception
56 {
57 layer = null;
58 }
59
60
61
62
63
64 @Test
65 public void testActionunknown()
66 {
67 InputStream sInput;
68 OutputStream sOutput;
69 sInput = new ByteArrayInputStream(data);
70 sOutput = new ByteArrayOutputStream();
71
72 layer.setInputStream(sInput);
73 layer.setOutputStream(sOutput);
74 layer.setAction(Action.UNKOWN);
75 layer.setEndController(endController);
76
77 layer.run();
78 }
79
80 }