@Test
	public void testCrud() {
		FieldValueCounter counter = new FieldValueCounter(tickersFieldValueCounterName);

		// Test with initial save
		FieldValueCounter fvTickersCounter = fieldValueCounterRepository.save(counter);
		assertThat(fieldValueCounterRepository.findOne(fvTickersCounter.getName()), notNullValue());

		fieldValueCounterRepository.increment(tickersFieldValueCounterName, "VMW");
		Map<String, Double> counts = fieldValueCounterRepository.findOne(tickersFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("VMW"), equalTo(1.0));

		fieldValueCounterRepository.increment(tickersFieldValueCounterName, "VMW");
		counts = fieldValueCounterRepository.findOne(tickersFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("VMW"), equalTo(2.0));

		//Check that we can save back another value.
		fvTickersCounter.getFieldValueCount().put("VMW", 1.0D);
		fieldValueCounterRepository.save(counter);
		counts = fieldValueCounterRepository.findOne(tickersFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("VMW"), equalTo(1.0));
		//Increment again to prepare for decrement test below
		fieldValueCounterRepository.increment(tickersFieldValueCounterName, "VMW");

		fieldValueCounterRepository.increment(tickersFieldValueCounterName, "ORCL");
		counts = fieldValueCounterRepository.findOne(tickersFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("ORCL"), equalTo(1.0));

		// Test without prior save

		fieldValueCounterRepository.increment(mentionsFieldValueCounterName, "mama");
		counts = fieldValueCounterRepository.findOne(mentionsFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("mama"), equalTo(1.0));

		fieldValueCounterRepository.increment(mentionsFieldValueCounterName, "mama");
		counts = fieldValueCounterRepository.findOne(mentionsFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("mama"), equalTo(2.0));

		fieldValueCounterRepository.increment(mentionsFieldValueCounterName, "papa");
		counts = fieldValueCounterRepository.findOne(mentionsFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("papa"), equalTo(1.0));

		fieldValueCounterRepository.decrement(tickersFieldValueCounterName, "VMW");
		counts = fieldValueCounterRepository.findOne(tickersFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("VMW"), equalTo(1.0));

		fieldValueCounterRepository.decrement(mentionsFieldValueCounterName, "mama");
		counts = fieldValueCounterRepository.findOne(mentionsFieldValueCounterName).getFieldValueCount();
		assertThat(counts.get("mama"), equalTo(1.0));

	}
Base tests for various implementations of {@link FieldValueCounterRepository}.

@author Eric Bottard
@author Mark Pollack
spring-xd-analytics/src/test/java/org/springframework/xd/analytics/metrics/AbstractFieldValueCounterRepositoryTests.java