Created
May 5, 2011 12:24
-
-
Save elefevre/956948 to your computer and use it in GitHub Desktop.
Show how variables with names that seem redundant with their values can be very readable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleWithExpliciteNamingTest { | |
private static final DateTime JANUARY_2 = utc(2000, 1, 2); | |
private static final DateTime JANUARY_3 = utc(2000, 1, 3); | |
private static final DateTime JANUARY_4 = utc(2000, 1, 4); | |
@Test | |
public void canGetRatioComparedToThePastNthDay() { | |
assertThat(evaluator.evaluateVariationsWithPastNthDay(dailyPerformances(JANUARY_4, 10000.0, 0.0, JANUARY_3, 10000.0, 0.0, JANUARY_2, 1000.0, 0.0), 2, null).getValue()).isEqualTo(9.0); | |
assertThat(evaluator.evaluateVariationsWithPastNthDay(dailyPerformances(JANUARY_3, 10000.0, 0.0, JANUARY_2, 1000.0, 0.0), 1, null).getValue()).isEqualTo(9.0); | |
assertThat(evaluator.evaluateVariationsWithPastNthDay(dailyPerformances(JANUARY_4, 4000.0, 1000.0, JANUARY_3, 2000.0, 1000.0, JANUARY_2, 1000.0, 1000.0), 1, null).getValue()).isEqualTo(1.0); | |
assertThat(evaluator.evaluateVariationsWithPastNthDay(dailyPerformances(JANUARY_4, 4000.0, 1000.0, JANUARY_3, 2000.0, 1000.0, JANUARY_2, 1000.0, 1000.0), 2, null).getValue()).isEqualTo(3.0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment