|Code for this tutorial: https://github.com/dsp-de/tutorial-dark-triangles|
Triangle.contains(Triangle t)and it is supposed to check if the triangle contains some other triangle t. For example the green triangle on the right contains the red one, i.e.
greenTriangle.contains(redTriangle)should be true. On the other hand the red doesn't contain the green one, i.e.
redTriangle.contains(greenTriangle)should be false.
To solve the following task we recommend to use one or both of the following preparations.
You may optionally implement the
contains method yourself in a Test-First manner1). You don't need to do it, but this will strongly increase your chances to solve the task. Finding the correct implementation is not that easy. The main point of this preparation is to get some experience with finding test cases.
Your company decided that it is too difficult3) to develop the
contains(..) method within the company. So they announced that they want to buy an implementation. In response they got 17 implementations, but they doubt that many of them are correct. You got the job to find the implementation that is working. Of course you didn't get the source code, but you are a smart tester. Write some tests to find the implementation your company should actually buy. If you did the optional step, you can use the tests that your produced. Here is your guide to the source code:
clscontains the implementations
tstyou find the class
geometry.TriangleTest. This test exercises all the implementations using the same test methods for each.4)
ifOneTriangleIsVeryLargeAndTheOtherVerySmallis annotated with
@Ignoreand therefore ignored.
@Ignoreannotation and run the tests again.
createTriangle(..)method to create triangles. Don't use the constructors directly!
createTriangle(..)method to create triangles!