Professional Documents
Culture Documents
Clone the repository URL: (Anh copy URL này vào Intellij/Eclipse ạ.)
https://ge87hes@bitbucket.ase.in.tum.de/scm/PGDP2223W03H02/pgdp2223w03h02-
ge87hes.git
Password: Mermaid7618
Introduction:
Array methods that are required for processing large amounts of data and now need to be tested.
Think carefully about which errors could have crept into the implementations and which tests can be
used to discover them.
The code template provided with this task already contains an example test, so all you have to do to
complete this task is add JUnit 5 to your IDE and then write any number of methods over it with the
@Test annotation, in which you test the methods listed below.
2. Assertions
We want to compare the expected and the actual output.
JUnit offers a functionality that displays the test results in the IDE: Assertions. A call to the
method assertEquals(expected, actual) runs through if expected.equals(actual), if not, an
AssertionError is thrown and the test failed. This is then displayed in the IDE.
3. Imports
In order to be able to use the functionality of JUnit 5 in a class, you first have to import it. The
imports of the annotations and assertions look something like this:
Make sure that the annotations and assertions are imported from the Jupiter API, i.e. that the
string "jupiter" is included in the import statement.
Đề bài:
In the pgdp.tests package you will find the ArrayTest class, in which you should now implement tests
for the following methods:
• print()
• minAndMax()
• invert()
• intersect()
• inearize()
• bubbleSort()
bubbleSort is a method that sorts a given array in ascending order. So inputting [3, 1, 4, 5, 2] returns
array [1, 2, 3, 4, 5] and inputting [4, 3, 4, 1, 1] returns array [1, 1 , 3, 4, 4] is returned.
We have prepared some flawed implementations of the six methods to be found in our tests of your
tests. Write enough tests for each method to find all of these incorrect implementations. Of course,
we won't show you our flawed implementations of the six methods. After all, testing is about finding
errors in a program without looking at the actual program code. However, with each push we already
tell you for each of the six methods whether you have found all wrong implementations. After each
push, you know immediately how many of the six maximum achievable points you would receive with
this after the deadline.
The PinguLib can help you to read output from the console.
Tips: