Skip to content
Snippets Groups Projects
Commit 5a0f7803 authored by cristiano's avatar cristiano
Browse files

Complete Fitnesse code + table

parent 0d6dfcf7
Branches
Tags
No related merge requests found
Showing
with 24217 additions and 36 deletions
package exceptions;
public class BidNullException extends Exception{
public BidNullException() {
super("your offer is invalid");
}
}
package project;
import exceptions.BidBelowZeroException;
import exceptions.BidNullException;
public class AuctionManager {
......@@ -20,11 +19,9 @@ public class AuctionManager {
return new AuctionManager();
}
public boolean placeBid(int user, Integer value) throws BidBelowZeroException, BidNullException {
public boolean placeBid(int user, Integer value) throws BidBelowZeroException {
if (value.equals(null)) {
throw new BidNullException();
} else if (value < 1) {
if (value < 1) {
throw new BidBelowZeroException();
} else if (value > 1) {
User u = User.getUserById(user);
......
package fitNesseFixture;
import exceptions.BidBelowZeroException;
import exceptions.BidNullException;
import project.AuctionManager;
import project.User;
......@@ -10,25 +9,22 @@ public class AuctionManagerFixture {
private AuctionManager ab;
private int usr;
private Integer value = null;
public AuctionManagerFixture(int usr) {
User user = new User(usr);
this.usr = usr;
}
public String placeBid() {
ab = AuctionManager.getInstance();
try {
if(ab.placeBid(usr, value)) {
if (ab.placeBid(usr, value)) {
return "Bid placed!";
}
} catch (BidBelowZeroException e) {
return e.getMessage();
} catch (BidNullException e) {
return e.getMessage();
}
}
return null;
}
......
......@@ -15,7 +15,7 @@ public class ItemFixture {
private Item i;
private int item, picture;
private String title, description, category;
private ArrayList<ItemPicture> images;
private ArrayList<ItemPicture> images = new ArrayList<ItemPicture>();
public ItemFixture(String cat) {
this.category = cat;
......@@ -26,6 +26,7 @@ public class ItemFixture {
for (int i : imagesToCreate) {
ItemPicture ip = new ItemPicture();
ip.setId(i);
images.add(ip);
}
}
......@@ -73,6 +74,14 @@ public class ItemFixture {
public void setPicture(int picture) {
this.picture = picture;
}
public void setImages(int[] imgs) {
for (int i : imgs) {
ItemPicture ip = new ItemPicture();
ip.setId(i);
images.add(ip);
}
}
public void setCategory(String category) {
this.category = category;
......
File added
File added
File added
File added
File added
File added
|clar||18:10:48 dom, nov 24, 2019|
|clar||17:06:57 mar, nov 26, 2019|
|FitNesse.UserGuide.WritingAcceptanceTests.SliM.ExceptionHandling||11:49:07 mar, ott 29, 2019|
|FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestExceptionIsDisplayed||11:24:26 mar, ott 29, 2019|
---
Help: Lists tests failed during last run, so they can be run again (without running all tests that passed).
Suite
---
!note This page is automatically generated when running tests. It will be overwritten by the next Suite or Test execution.
Tests failed (first failure was at 2019-11-24T18:20:55.591469200):
!see [[clar][.clar]]
......@@ -115,8 +115,8 @@ aaaaaaaaaaaaaaaa-! | camera | Error: description not correct |
| title | description | | Error: category not correct |
| title | description | camera | Item modified! |
| fitNesseFixture.ItemFixture |[1,2]|
| picture | addPicture? |
| fitNesseFixture.ItemFixture | [1,2]|
| images | addPicture? |
| [] | Error: there are problems with the pictures, please check |
| [1,2] | Pictures added! |
......@@ -124,5 +124,4 @@ aaaaaaaaaaaaaaaa-! | camera | Error: description not correct |
| value | placeBid? |
| 0 | your offer cannot be below 1 |
| -1 | your offer cannot be below 1 |
|| your offer is invalid |
| 3 | Bid placed! |
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment