Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed test with null Persistence-Manager and wrapped RuntimeExceptions
- Loading branch information
Showing
3 changed files
with
20 additions
and
10 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
21 changes: 14 additions & 7 deletions
21
aspectj/src/main/java/com/example/support/PersistenceManager.java
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package com.example.support; | ||
|
||
public interface PersistenceManager { | ||
void begin(); | ||
void commit(); | ||
void rollback(); | ||
public class PersistenceManager { | ||
void begin() {} | ||
void commit() {} | ||
void rollback() {} | ||
|
||
<T> T persist(T entity); | ||
void delete(Object entity); | ||
<T> T load(Class<T> type, long id); | ||
<T> T persist(T entity) { return entity; } | ||
void delete(Object entity) {} | ||
|
||
<T> T load(Class<T> type, long id) { | ||
try { | ||
return type.newInstance(); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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