Skip to content
Snippets Groups Projects
Commit 2060f94d authored by Alexander Görlitz's avatar Alexander Görlitz
Browse files

Updated tests

parent afbb30fd
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ public interface Repository { ...@@ -94,7 +94,7 @@ public interface Repository {
Id<TeamMember> teamMemberId(); Id<TeamMember> teamMemberId();
void saveTeamMember(TeamMember TeamMember) throws Exception; TeamMember saveTeamMember(TeamMember TeamMember) throws Exception;
TeamMember removeTeamMember(Id<OperationTeam> operationTeamId, Id<OPStaff> opStaffId) throws Exception; TeamMember removeTeamMember(Id<OperationTeam> operationTeamId, Id<OPStaff> opStaffId) throws Exception;
......
...@@ -21,16 +21,18 @@ public class TeamMemberImpl implements TeamMemberService{ ...@@ -21,16 +21,18 @@ public class TeamMemberImpl implements TeamMemberService{
return repo.getOperationTeamOPStaffImpl(operationTeamId); return repo.getOperationTeamOPStaffImpl(operationTeamId);
} }
private TeamMember assignStaffimpl(TeamMember.AssignStaff as) { private TeamMember assignStaffimpl(TeamMember.AssignStaff as) throws Exception {
TeamMember teammember = TeamMember teammember =
new TeamMember( new TeamMember(
as.operationTeamId(), as.operationTeamId(),
as.opStaffId(), as.opStaffId(),
Instant.now() Instant.now()
); );
return teammember; return repo.saveTeamMember(teammember);
} }
private TeamMember removeStaffimpl(TeamMember.RemoveStaff rs) throws Exception { private TeamMember removeStaffimpl(TeamMember.RemoveStaff rs) throws Exception {
return repo.removeTeamMember(rs.operationTeamId(), rs.opStaffId()); return repo.removeTeamMember(rs.operationTeamId(), rs.opStaffId());
......
...@@ -640,7 +640,7 @@ class JDBCRepository implements Repository ...@@ -640,7 +640,7 @@ class JDBCRepository implements Repository
return new Id<TeamMember>(randomUUID().toString()); //TODO findOperation(id).isEmpty() ? id : operationId(); return new Id<TeamMember>(randomUUID().toString()); //TODO findOperation(id).isEmpty() ? id : operationId();
} }
public void saveTeamMember(TeamMember TeamMember) throws Exception{ public TeamMember saveTeamMember(TeamMember TeamMember) throws Exception{
try( try(
var stmt = conn.createStatement() var stmt = conn.createStatement()
...@@ -657,6 +657,7 @@ class JDBCRepository implements Repository ...@@ -657,6 +657,7 @@ class JDBCRepository implements Repository
}catch(SQLException e){ }catch(SQLException e){
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return TeamMember;
} }
public TeamMember removeTeamMember(Id<OperationTeam> operationTeamId, Id<OPStaff> opStaffId) throws Exception{ public TeamMember removeTeamMember(Id<OperationTeam> operationTeamId, Id<OPStaff> opStaffId) throws Exception{
......
...@@ -333,14 +333,21 @@ public final class Tests ...@@ -333,14 +333,21 @@ public final class Tests
OperationTeam deleteOperationTeam = operationTeamService.process(deleteCommand); OperationTeam deleteOperationTeam = operationTeamService.process(deleteCommand);
} }
//@Test @Test
public void testInsertTeamMember1() throws Exception{ public void testInsertTeamMember1() throws Exception{
try { TeamMember.AssignStaff assignCommand = new TeamMember.AssignStaff(
new Id<OperationTeam>("31"),
new Id<OPStaff>("4444")
);
TeamMember assignStaff = teamMemberService.process(assignCommand);
/*try {
repo.saveTeamMember(testTeamMember); repo.saveTeamMember(testTeamMember);
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }*/
} }
//@Test //@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment