1+ package com .yocto .yoclib .imap .tests .protocol ;
2+
3+ import com .yocto .yoclib .imap .protocol .ProtocolAtom ;
4+ import com .yocto .yoclib .imap .protocol .ProtocolObject ;
5+ import com .yocto .yoclib .imap .protocol .ProtocolSectionPartial ;
6+ import com .yocto .yoclib .imap .protocol .ProtocolSubordinate ;
7+
8+ import org .junit .jupiter .api .Test ;
9+
10+ import static org .junit .jupiter .api .Assertions .assertEquals ;
11+ import static org .junit .jupiter .api .Assertions .assertNotEquals ;
12+ import static org .junit .jupiter .api .Assertions .assertNull ;
13+
14+ public class ProtocolSectionPartialTest {
15+
16+ @ Test
17+ public void testEquals (){
18+ ProtocolAtom atom = new ProtocolAtom ("a" );
19+
20+ assertEquals (new ProtocolSectionPartial (atom ),new ProtocolSectionPartial (atom ));
21+
22+ assertNotEquals (new ProtocolSectionPartial (atom ),null );
23+ assertNotEquals (null ,new ProtocolSectionPartial (atom ));
24+
25+ assertNotEquals (new ProtocolSectionPartial (atom ),atom );
26+ assertNotEquals (atom ,new ProtocolSectionPartial (atom ));
27+ }
28+
29+ @ Test
30+ public void testGetAtom (){
31+ assertEquals (new ProtocolAtom ("a" ),new ProtocolSectionPartial (new ProtocolAtom ("a" )).getAtom ());
32+ }
33+
34+ @ Test
35+ public void testGetSubordinate (){
36+ assertNull (new ProtocolSectionPartial (new ProtocolAtom ("a" )).getSubordinate ());
37+ assertEquals (new ProtocolSubordinate (new ProtocolObject []{
38+ new ProtocolAtom ("ab" )
39+ }),new ProtocolSectionPartial (new ProtocolAtom ("a" ),new ProtocolSubordinate (new ProtocolObject []{
40+ new ProtocolAtom ("ab" )
41+ })).getSubordinate ());
42+ }
43+
44+ @ Test
45+ public void testGetPartialOffset (){
46+ assertNull (new ProtocolSectionPartial (new ProtocolAtom ("a" ),new ProtocolSubordinate (new ProtocolObject []{
47+ new ProtocolAtom ("ab" )
48+ })).getPartialOffset ());
49+ assertEquals (123 ,new ProtocolSectionPartial (new ProtocolAtom ("a" ),new ProtocolSubordinate (new ProtocolObject []{
50+ new ProtocolAtom ("ab" )
51+ }),123 ).getPartialOffset ());
52+ }
53+
54+ @ Test
55+ public void testGetPartialLength (){
56+ assertNull (new ProtocolSectionPartial (new ProtocolAtom ("a" ),123 ).getPartialLength ());
57+ assertEquals (456 ,new ProtocolSectionPartial (new ProtocolAtom ("a" ),123 ,456 ).getPartialLength ());
58+
59+ assertNull (new ProtocolSectionPartial (new ProtocolAtom ("a" ),new ProtocolSubordinate (new ProtocolObject []{
60+ new ProtocolAtom ("ab" )
61+ }),123 ).getPartialLength ());
62+ assertEquals (456 ,new ProtocolSectionPartial (new ProtocolAtom ("a" ),new ProtocolSubordinate (new ProtocolObject []{
63+ new ProtocolAtom ("ab" )
64+ }),123 ,456 ).getPartialLength ());
65+ }
66+
67+ }
0 commit comments