@Test
	public void sorting() {
		StreamDefinition one = new StreamDefinition("one", "http | hdfs");
		StreamDefinition two = new StreamDefinition("two", "tcp | file");
		StreamDefinition three = new StreamDefinition("three", "http | file");
		StreamDefinition four = new StreamDefinition("four", "http | file");
		StreamDefinition five = new StreamDefinition("five", "http | file");
		repository.save(Arrays.asList(one, two, three, four, five));

		Assert.assertEquals(5, repository.count());

		PageRequest pageable = new PageRequest(1, 2);
		Page<StreamDefinition> sub = repository.findAll(pageable);

		Assert.assertEquals(5, sub.getTotalElements());
		Assert.assertEquals(1, sub.getNumber());
		Assert.assertEquals(2, sub.getNumberOfElements());
		Assert.assertEquals(2, sub.getSize());
		Assert.assertEquals(3, sub.getTotalPages());
		List<StreamDefinition> content = sub.getContent();
		Assert.assertEquals("one", content.get(0).getName());
		Assert.assertEquals("three", content.get(1).getName());

	}
Unit tests for {@link ZooKeeperStreamDefinitionRepository}.

@author Eric Bottard
@author David Turanski
@author Gary Russell
@author Mark Fisher
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/stream/zookeeper/ZooKeeperStreamDefinitionRepositoryTests.java