A little bit about refactoring in TDD

Image for post
Image for post
Photo by Fancycrave on Unsplash
scala> 1.0 / 9223372036854775807.0
res6: Double = 1.0842021724855044E-19
scala> 1.0 / 9223372036854775806.0
res7: Double = 1.0842021724855044E-19
scala> res13 == res14
res8: Boolean = true
    @Test
public void testNotEqualsCloseFraction() {
Fraction numberA = new Fraction(1, Long.MAX_VALUE);
Fraction numberB = new Fraction(1, Long.MAX_VALUE - 1);
assertNotEquals(numberA, numberB);
}
@Test
public void testGetNumerator() {
System.out.println("getNumerator");
Fraction fract = new Fraction(75, 100);
long expected = 3L;
long actual = fract.getNumerator();
assertEquals(expected, actual);
}

@Test
public void testGetDenominator() {
System.out.println("getDenominator");
Fraction fract = new Fraction(75, 100);
long expected = 4L;
long actual = fract.getDenominator();
assertEquals(expected, actual);
}

is a composer and photographer from Detroit, Michigan. He has been working on a Java program to display certain mathematical diagrams.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store