@Test
  public void formatAverage()
  {

	// As a next step the code needs PrecisionLab to use it for data rounding.
	// The PrecisionLab instance can be created using various factory methods in abstract factory or from the
	// concrete factory implementation.
	final Map<SampleRoundingContext, Integer> dps = new HashMap<SampleRoundingContext, Integer>();
	dps.put(new SampleRoundingContext("EURUSD", "SN", "junior"), 3);
	dps.put(new SampleRoundingContext("EURUSD", "1W", "junior"), 2);
	dps.put(new SampleRoundingContext("EURUSD", "2W", "junior"), 2);
	dps.put(new SampleRoundingContext("EURUSD", "SN", "mid"), 4);
	dps.put(new SampleRoundingContext("EURUSD", "1W", "mid"), 3);
	dps.put(new SampleRoundingContext("EURUSD", "2W", "mid"), 2);
	dps.put(new SampleRoundingContext("EURUSD", "SN", "senior"), 7);
	dps.put(new SampleRoundingContext("EURUSD", "1W", "senior"), 6);
	dps.put(new SampleRoundingContext("EURUSD", "2W", "senior"), 5);
	final PrecisionLab lab = LAB_FACTORY.createPrecisionLab(dps);

	// Consider these data
	final String[] values = { "1.03", "1.157", "0.23007", "-3.1", "4.10", "-1.01" };
	// Let's calculate the average
	DecimalImpl sum = DecimalImpl.valueOf("0");
	for (String s : values)
	{
	  sum = sum.add(DecimalImpl.valueOf(s));
	}
	final DecimalImpl avg = sum.div(values.length);

	// Following outputs some generic view of the decimal.
	// Do not use it for any business or functional needs.
	System.out.println("Calculated average " + avg);

	// Now will output a matrix of formatted values by tenors and roles
	final String currencyPair = "EURUSD";
	final String[] tenors = { "SN", "1W", "2W" };
	final String[] roles = { "junior", "mid", "senior" };
	final String[] rates = new String[tenors.length];

	// Print the formatted matrix
	printRow("Role\\Tenor", tenors);
	for (String role : roles)
	{
	  int i = 0;
	  for (String tenor : tenors)
	  {
		rates[i++] = lab.format(avg, new SampleRoundingContext(currencyPair, tenor, role), RoundingMethod.DOWN);
	  }
	  printRow(role, rates);
	}

  }