public void assertDeserialized(Serializable initial, Serializable deserialized) { SortResponseControl initThr = (SortResponseControl) initial; SortResponseControl dserThr = (SortResponseControl) deserialized; // verify ResultCode int initResultCode = initThr.getResultCode(); int dserResultCode = dserThr.getResultCode(); assertTrue(initResultCode == dserResultCode); // verify BadAttrId String initBadAttrId = initThr.getAttributeID(); String dserBadAttrId = dserThr.getAttributeID(); assertEquals(initBadAttrId, dserBadAttrId); }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl003() { String Id=null; boolean crit=true; byte[] ber={}; try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("Insufficient data."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl004() { String Id=null; boolean crit=false; byte[] ber={}; try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("Insufficient data."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl005() { String Id=null; boolean crit=false; byte[] ber=new String("ID").getBytes(); try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl006() { String Id=null; boolean crit=false; try { byte[] ber={48,3,10,1,0}; assertNotNull(new SortResponseControl(Id,crit,ber)); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl010() { String Id=""; boolean crit=true; try { byte[] ber={}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl011() { String Id=""; boolean crit=false; try { byte[] ber={}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl012() { String Id=""; boolean crit=true; try { byte[] ber={10,20,12}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl013() { String Id=""; boolean crit=false; try { byte[] ber={10,20,12}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl014() { String Id=""; boolean crit=false; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl015() { String Id=""; boolean crit=true; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor. With this test * we see that the string Id and the criticality does not matter, olny the BER value.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl016() { String Id="test"; boolean crit=true; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing the constructor. With this test * we see that the string Id and the criticality does not matter, olny the BER value.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl017() { String Id="test"; boolean crit=false; try { byte[] ber={3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl003() { String Id=null; boolean crit=true; byte[] ber={}; try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("Insufficient data."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl004() { String Id=null; boolean crit=false; byte[] ber={}; try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("Insufficient data."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception like IOException.</p> */ public void testSortResponseControl005() { String Id=null; boolean crit=false; byte[] ber=new String("ID").getBytes(); try { SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl006() { String Id=null; boolean crit=false; try { byte[] ber={48,3,10,1,0}; assertNotNull(new SortResponseControl(Id,crit,ber)); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl010() { String Id=""; boolean crit=true; try { byte[] ber={}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl011() { String Id=""; boolean crit=false; try { byte[] ber={}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl012() { String Id=""; boolean crit=true; try { byte[] ber={10,20,12}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl013() { String Id=""; boolean crit=false; try { byte[] ber={10,20,12}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl014() { String Id=""; boolean crit=false; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl015() { String Id=""; boolean crit=true; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request. With this test * we see that the string Id and the criticality does not matter, olny the BER value.</p> * <p>The expected result is an instance of the class.</p> */ public void testSortResponseControl016() { String Id="test"; boolean crit=true; try { byte[] ber={48,3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); assertNotNull(src); } catch (IOException e) { fail("The bytes are in the ASN.1 BER."); } }
/** * <p>Test method for 'javax.naming.ldap.SortResponseControl.SortResponseControl(String, boolean, byte[])'</p> * <p>Here we are testing if this method constructs a control to indicate the outcome of a sort request. With this test * we see that the string Id and the criticality does not matter, olny the BER value.</p> * <p>The expected result is an exception.</p> */ public void testSortResponseControl017() { String Id="test"; boolean crit=false; try { byte[] ber={3,10,1,0}; SortResponseControl src=new SortResponseControl(Id,crit,ber); fail("The bytes are not in the ASN.1 BER."); } catch (IOException e) { } }
@Test public void testPostProcess() throws Exception { byte sortResult = 0; // success byte[] value = encodeValue(sortResult); SortResponseControl control = new SortResponseControl( "dummy", true, value); when(ldapContextMock.getResponseControls()).thenReturn( new Control[]{control}); tested.postProcess(ldapContextMock); assertThat(tested.isSorted()).isEqualTo(true); assertThat(tested.getResultCode()).isEqualTo(0); }
@Test public void testPostProcess_NonSuccess() throws Exception { byte sortResult = 1; byte[] value = encodeValue(sortResult); SortResponseControl control = new SortResponseControl( "dummy", true, value); when(ldapContextMock.getResponseControls()).thenReturn(new Control[] { control }); tested.postProcess(ldapContextMock); assertThat(tested.isSorted()).isEqualTo(false); assertThat(tested.getResultCode()).isEqualTo(1); }