AttackModel { @Override public String toString() { return String.format( "AttackModel[a=%s, e=%s, p=%s]", doSAttack.getName(), position, payloadPosition ); } AttackModel(); String getRequestContent(); void setRequestContent( String requestContent ); CommonParamItem getParamItem(); void setParamItem( CommonParamItem paramItem ); int getNumberOfRequests(); int getNumberOfThreads(); int getMilliesBetweenRequests(); int getServerRecoveryBeforeSend(); void setServerRecoveryBeforeSend( int serverRecoveryBeforeSend ); RequestType getRequestType(); void setRequestType( RequestType requestType ); Position getPosition(); void setPosition( Position position ); PayloadPosition getPayloadPosition(); void setPayloadPosition( PayloadPosition payloadPosition ); DoSAttack getDoSAttack(); void setDoSAttack( DoSAttack doSAttack ); int getErrorCount(); int getSOAPFaultCount(); boolean wasAttackExecutionSuccessful(); boolean isAllFail(); boolean isAllSOAPFault(); List<Metric> getMetrics(); Long[] getDurationArray(); synchronized void addMetric( Metric metric ); void increase(); void addPropertyChangeListener( PropertyChangeListener listener ); void removePropertyChangeListener( PropertyChangeListener listener ); int getProgress(); static AttackModelBuilder custom(); @Override String toString();  }
@Test public void toStringTest() { DoSAttack doSAttack = mock( DoSAttack.class ); when( doSAttack.getName() ).thenReturn( "lorem" ); attackModel.setDoSAttack( doSAttack ); Position position = mock( Position.class ); when( position.toString() ).thenReturn( "a/b" ); attackModel.setPosition( position ); attackModel.setPayloadPosition( PayloadPosition.ELEMENT ); assertThat( attackModel.toString(), is( "AttackModel[a=lorem, e=a/b, p=ELEMENT]" ) ); }