[TDD] Triangulation

1. This is not Triangulation

	public void testMultiplication(){
		Assert.assertEquals(new Dollar(3).times(2),6 );
	}

	public int times(int i) {		
		return 6;
	}

2. This is Triangulation


	public void testMultiplication(){
		Assert.assertEquals(new Dollar(3).times(2),6 );
		Assert.assertEquals(new Dollar(4).times(3),12 );
	}

	public int times(int i) {		
		return amount * i; 
	}

3.A Triangle? Yes

   		
		//test
		Assert.assertEquals(new Dollar(3).times(2),6 ); //1
		Assert.assertEquals(new Dollar(4).times(3),12 ); //2
		//code
		return amount * i; //3

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.