-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from aphextinez/software-testing
Fix delete() in Entity.java with tx.success(), add portfolio functions
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ public void delete() { | |
r.delete(); | ||
} | ||
internalNode.delete(); | ||
tx.success(); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,30 @@ public void check_addToPortfolio() { | |
} | ||
} | ||
|
||
@Test | ||
public void check_addAndDeletePortfolio() { | ||
try(Transaction tx = app.GraphDatabase.get().beginTx()) { | ||
String uemail = "[email protected]"; | ||
String upass = "password"; | ||
app.Email email = new app.Email(uemail); | ||
app.User user = new app.User(); | ||
user.setPassword(upass); | ||
user.addEmail(email); | ||
app.Citation[] array = new app.Citation[] { new app.Citation("blah", "bloo"), new app.Citation("boppidee", "bbbb"), | ||
new app.Citation("hehe", "haha"), new app.Citation("heehaw", "meemaw")}; | ||
for (app.Citation c : array) { | ||
user.addToPortfolio(c); | ||
} | ||
Iterator<app.Citation> iterator = user.viewPortfolio().iterator(); | ||
assertTrue(iterator.hasNext()); | ||
while (iterator.hasNext() ) { | ||
app.Citation cGet = iterator.next(); | ||
user.removeFromPortfolio(cGet); | ||
} | ||
Iterator<app.Citation> iteratorCheck = user.viewPortfolio().iterator(); | ||
assertFalse(iteratorCheck.hasNext()); | ||
tx.success(); | ||
} | ||
} | ||
|
||
} |