Skip to content
Permalink
Browse files
mock rest tests improvement
  • Loading branch information
fiammara committed Dec 20, 2019
1 parent 460c255 commit 9648c8b214f2235f91ff57f7ab56b4624e979276
Showing 3 changed files with 224 additions and 152 deletions.
@@ -271,6 +271,18 @@ public Ok deletePet(String apiKey, long petId) throws IdNotFound, NotAcceptable
store.removePet(petId);
return OK;
}

@RestMethod(
name=DELETE,
path="/pets",
summary="Delete all pets",
description="This can be done only by the logged in user."

)
public Ok deleteAllPets() {
store.deleteAllPets();
return OK;
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Orders
@@ -369,6 +381,18 @@ public Ok deleteOrder(long orderId) throws InvalidId, IdNotFound, NotAcceptable
store.removeOrder(orderId);
return OK;
}

@RestMethod(
name=DELETE,
path="/orders",
summary="Delete all orders",
description="This can be done only by the logged in user."

)
public Ok deleteAllOrders() {
store.deleteAllOrders();
return OK;
}

@Override
@RestMethod(
@@ -477,6 +501,17 @@ public Ok deleteUser(String username) throws InvalidUsername, IdNotFound, NotAcc
store.removeUser(username);
return OK;
}
@RestMethod(
name=DELETE,
path="/users",
summary="Delete all users",
description="This can be done only by the admin."

)
public Ok deleteAllUsers() {
store.deleteAllUsers();
return OK;
}

@Override
@RestMethod(
@@ -487,6 +522,8 @@ public Ok deleteUser(String username) throws InvalidUsername, IdNotFound, NotAcc
tags="user"
)
)


public Ok login(
String username,
String password,
@@ -331,4 +331,22 @@ private void assertValidUsername(String username) throws InvalidUsername {
private InputStream getStream(String fileName) {
return getClass().getResourceAsStream(fileName);
}


public void deleteAllPets() {
petRepository.deleteAll();

}


public void deleteAllUsers() {
userRepository.deleteAll();

}


public void deleteAllOrders() {
orderRepository.deleteAll();

}
}

0 comments on commit 9648c8b

Please sign in to comment.