@Test
	public void testUpdate() {
		SingleConsole singleConsole = new SingleConsole(getFreePort()) {
			@Override
			public long getCurrentRunningTime() {
				return 2000;
			}

			@Override
			public Map<String, Object> getStatisticsData() {
				Map<String, Object> newMap = new HashMap<String, Object>();
				Map<Object, Object> errorMap = new HashMap<Object, Object>();
				errorMap.put("Tests", testCount);
				errorMap.put("Errors", errorCount);
				newMap.put("totalStatistics", errorMap);
				return newMap;
			}

			@Override
			protected void updateStatistics(StatisticsSet intervalStatisticsSnapshot,
			                                StatisticsSet accumulatedStatisticsSnapshot) {
			}

		};

		singleConsole.update(null, null);
		singleConsole.startSampling();

		SampleModelImplementationEx sampleModelMock = mock(SampleModelImplementationEx.class);

		singleConsole.setSampleModel(sampleModelMock);
		StatisticExpression exp = mock(StatisticExpression.class);
		StatisticsSet statisticMock = mock(StatisticsSet.class);
		StatisticsSet statisticAccumulatedMock = mock(StatisticsSet.class);
		when(statisticMock.snapshot()).thenReturn(statisticMock);
		when(statisticAccumulatedMock.snapshot()).thenReturn(statisticAccumulatedMock);
		when(exp.getDoubleValue(any(StatisticsSet.class))).thenReturn(3D);
		when(sampleModelMock.getTPSExpression()).thenReturn(exp);

		singleConsole.update(statisticMock, statisticAccumulatedMock);
		singleConsole.update(statisticMock, statisticAccumulatedMock);

	}
Returns a free port number on localhost, or -1 if unable to find a free port.

@return a free port number on localhost, or -1 if unable to find a free port
ngrinder-core/src/test/java/net/grinder/SingleConsoleTest.java