Skip to content
Snippets Groups Projects
Commit 403157e1 authored by Righi Andrea (Student Com17)'s avatar Righi Andrea (Student Com17)
Browse files

modified acceptanceTest and started uploading testing classes

parent 7e054a53
No related branches found
No related tags found
No related merge requests found
......@@ -96,12 +96,12 @@
## AuctionManager
| | **placeBid** | |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| **Input** | **Description** | **Output** |
| | *precondition: user logged in and subscribed to the auction* | |
| Two bids with the same timestamp value | | |
| New bid with timestamp > endTime of the auction | | Throws EndedAuctionException |
| New bid with the currentValue + fixed value chosen by the seller | | the user is set as a currentWinner and computePrice( ) is called |
| | **placeBid** | |
| -------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| **Input** | **Description** | **Output** |
| | *precondition: user logged in and subscribed to the auction* | |
| A negative value bid | the method checks if the input for the bid is a positive integer: if it is not, it does not do any operation and show an error message | no operation is done and an error message is showed: "your offer cannot be a negative number, please try again" |
| A decimal value bid | the method checks if the input for the bid is a positive integer: if it is not, it does not do any operation and show an error message | no operation is done and an error message is showed: "your offer cannot be a decimal number, please try again" |
| A integer value bid | the method checks if the input for the bid is a positive integer: if it is, it multiply it for the increment set by the user who is selling, it computes the actual price, sets the user which owns the bid as current winnter and returns true | price is computed, the user is set as winner and returns true |
\ No newline at end of file
......@@ -13,7 +13,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......@@ -23,5 +23,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<profiles>
<profile>
<id>unit</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
......@@ -11,26 +11,6 @@
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<profiles>
<profile>
<id>unit</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
......
package unitTest;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import project.Auction;
import project.Item;
public class AuctionUnitTest {
Auction a = Auction.getInstance();
Item i = Item.getInstance();
@ParameterizedTest
@ValueSource (ints = {1,2,3})
@ValueSource (ints = {1,2,3})
public void runsTenTimesTest(String text) {
for (int i = 0; i < 10; i++) {
assertTrue(text.equals("ehi"));
}
}
private static Stream<Arguments> generator() {
return Stream.of(Arguments.of(new Auction(), true), Arguments.of(new Auction(), false));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment