"0 compilation error, no test was runned"
This commit is contained in:
parent
ff85fa4e79
commit
5b116787d1
@ -3,7 +3,7 @@
|
|||||||
associations="true" dependencies="false" nesting-relationships="true" router="FAN">
|
associations="true" dependencies="false" nesting-relationships="true" router="FAN">
|
||||||
<class id="1" language="java" name="TD1.Forum" project="M315" file="/M315/src/TD1/Forum.java" binary="false"
|
<class id="1" language="java" name="TD1.Forum" project="M315" file="/M315/src/TD1/Forum.java" binary="false"
|
||||||
corner="BOTTOM_RIGHT">
|
corner="BOTTOM_RIGHT">
|
||||||
<position height="-1" width="-1" x="490" y="149"/>
|
<position height="-1" width="-1" x="461" y="178"/>
|
||||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
sort-features="false" accessors="true" visibility="true">
|
sort-features="false" accessors="true" visibility="true">
|
||||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
</class>
|
</class>
|
||||||
<class id="2" language="java" name="TD1.Admin" project="M315" file="/M315/src/TD1/Admin.java" binary="false"
|
<class id="2" language="java" name="TD1.Admin" project="M315" file="/M315/src/TD1/Admin.java" binary="false"
|
||||||
corner="BOTTOM_RIGHT">
|
corner="BOTTOM_RIGHT">
|
||||||
<position height="-1" width="-1" x="242" y="421"/>
|
<position height="-1" width="-1" x="122" y="173"/>
|
||||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
sort-features="false" accessors="true" visibility="true">
|
sort-features="false" accessors="true" visibility="true">
|
||||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</class>
|
</class>
|
||||||
<class id="3" language="java" name="TD1.Member" project="M315" file="/M315/src/TD1/Member.java" binary="false"
|
<class id="3" language="java" name="TD1.Member" project="M315" file="/M315/src/TD1/Member.java" binary="false"
|
||||||
corner="BOTTOM_RIGHT">
|
corner="BOTTOM_RIGHT">
|
||||||
<position height="-1" width="-1" x="801" y="403"/>
|
<position height="-1" width="-1" x="817" y="162"/>
|
||||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
sort-features="false" accessors="true" visibility="true">
|
sort-features="false" accessors="true" visibility="true">
|
||||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
</class>
|
</class>
|
||||||
<class id="4" language="java" name="TD1.Message" project="M315" file="/M315/src/TD1/Message.java" binary="false"
|
<class id="4" language="java" name="TD1.Message" project="M315" file="/M315/src/TD1/Message.java" binary="false"
|
||||||
corner="BOTTOM_RIGHT">
|
corner="BOTTOM_RIGHT">
|
||||||
<position height="-1" width="-1" x="504" y="471"/>
|
<position height="-1" width="-1" x="805" y="503"/>
|
||||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
sort-features="false" accessors="true" visibility="true">
|
sort-features="false" accessors="true" visibility="true">
|
||||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
</class>
|
</class>
|
||||||
<class id="5" language="java" name="TD1.MessageManager" project="M315" file="/M315/src/TD1/MessageManager.java"
|
<class id="5" language="java" name="TD1.MessageManager" project="M315" file="/M315/src/TD1/MessageManager.java"
|
||||||
binary="false" corner="BOTTOM_RIGHT">
|
binary="false" corner="BOTTOM_RIGHT">
|
||||||
<position height="-1" width="-1" x="791" y="122"/>
|
<position height="-1" width="-1" x="480" y="543"/>
|
||||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
sort-features="false" accessors="true" visibility="true">
|
sort-features="false" accessors="true" visibility="true">
|
||||||
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
@ -47,33 +47,37 @@
|
|||||||
</display>
|
</display>
|
||||||
</class>
|
</class>
|
||||||
<association id="6">
|
<association id="6">
|
||||||
<end type="SOURCE" refId="3" navigable="false">
|
|
||||||
<attribute id="7" name="msg"/>
|
|
||||||
<multiplicity id="8" minimum="0" maximum="2147483647"/>
|
|
||||||
</end>
|
|
||||||
<end type="TARGET" refId="4" navigable="true"/>
|
|
||||||
<display labels="true" multiplicity="true"/>
|
|
||||||
</association>
|
|
||||||
<association id="9">
|
|
||||||
<end type="SOURCE" refId="1" navigable="false">
|
<end type="SOURCE" refId="1" navigable="false">
|
||||||
<attribute id="10" name="admin"/>
|
<attribute id="7" name="admin">
|
||||||
<multiplicity id="11" minimum="0" maximum="1"/>
|
<position height="0" width="0" x="-120" y="-248"/>
|
||||||
|
</attribute>
|
||||||
|
<multiplicity id="8" minimum="0" maximum="1">
|
||||||
|
<position height="0" width="0" x="-120" y="-248"/>
|
||||||
|
</multiplicity>
|
||||||
</end>
|
</end>
|
||||||
<end type="TARGET" refId="2" navigable="true"/>
|
<end type="TARGET" refId="2" navigable="true"/>
|
||||||
<display labels="true" multiplicity="true"/>
|
<display labels="true" multiplicity="true"/>
|
||||||
</association>
|
</association>
|
||||||
<association id="12">
|
<association id="9">
|
||||||
<end type="SOURCE" refId="1" navigable="false">
|
<end type="SOURCE" refId="3" navigable="false">
|
||||||
<attribute id="13" name="messageManager"/>
|
<attribute id="10" name="msg">
|
||||||
<multiplicity id="14" minimum="0" maximum="1"/>
|
<position height="0" width="0" x="301" y="32"/>
|
||||||
|
</attribute>
|
||||||
|
<multiplicity id="11" minimum="0" maximum="2147483647">
|
||||||
|
<position height="0" width="0" x="301" y="32"/>
|
||||||
|
</multiplicity>
|
||||||
</end>
|
</end>
|
||||||
<end type="TARGET" refId="5" navigable="true"/>
|
<end type="TARGET" refId="4" navigable="true"/>
|
||||||
<display labels="true" multiplicity="true"/>
|
<display labels="true" multiplicity="true"/>
|
||||||
</association>
|
</association>
|
||||||
<association id="15">
|
<association id="12">
|
||||||
<end type="SOURCE" refId="1" navigable="false">
|
<end type="SOURCE" refId="1" navigable="false">
|
||||||
<attribute id="16" name="member"/>
|
<attribute id="13" name="member">
|
||||||
<multiplicity id="17" minimum="0" maximum="2147483647"/>
|
<position height="0" width="0" x="16" y="-241"/>
|
||||||
|
</attribute>
|
||||||
|
<multiplicity id="14" minimum="0" maximum="2147483647">
|
||||||
|
<position height="0" width="0" x="16" y="-241"/>
|
||||||
|
</multiplicity>
|
||||||
</end>
|
</end>
|
||||||
<end type="TARGET" refId="3" navigable="true"/>
|
<end type="TARGET" refId="3" navigable="true"/>
|
||||||
<display labels="true" multiplicity="true"/>
|
<display labels="true" multiplicity="true"/>
|
||||||
|
@ -3,27 +3,39 @@ package TD1;
|
|||||||
public class Admin {
|
public class Admin {
|
||||||
|
|
||||||
private String nom;
|
private String nom;
|
||||||
|
private Forum forum;
|
||||||
|
|
||||||
public Admin() {
|
public Admin() {
|
||||||
this(null);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Admin(String n) {
|
public Admin(String n, Forum f) {
|
||||||
this.nom = n;
|
this.setNom(n);
|
||||||
|
this.setForum(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
|
||||||
|
|
||||||
public void knowMembers() {
|
public void knowMembers() {
|
||||||
//TODO
|
System.out.println(this.forum.getMembers().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int knowMembersCount() {
|
||||||
|
return this.forum.getMembers().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getForum() {
|
public Forum getForum() {
|
||||||
return this.nom;
|
return this.forum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForum(String n) {
|
public void setForum(Forum forum) {
|
||||||
this.nom = n;
|
this.forum = forum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNom() {
|
||||||
|
return nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNom(String nom) {
|
||||||
|
this.nom = nom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,39 @@
|
|||||||
package TD1;
|
package TD1;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Forum {
|
public class Forum {
|
||||||
private String nom;
|
private String nom;
|
||||||
private Admin admin;
|
private Admin admin;
|
||||||
private MessageManager messageManager;
|
private MessageManager mg;
|
||||||
private List<Member> member = new ArrayList<Member>();
|
private List<Member> member = new ArrayList<Member>();
|
||||||
|
private List<Message> lmsg = new ArrayList<Message>();
|
||||||
|
|
||||||
public Forum() {
|
public Forum(String n, MessageManager msgManager) {
|
||||||
this(null, null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Forum(String n) {
|
|
||||||
this(n, null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Forum(String n,Admin a, MessageManager mg, List<Member> m) {
|
|
||||||
this.setNom(n);
|
this.setNom(n);
|
||||||
this.admin=a;
|
this.setMessageManager(msgManager);
|
||||||
this.messageManager=mg;
|
|
||||||
this.member=m;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createMessage() {
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createMessageManager() {
|
public void createMessageManager() {
|
||||||
// TODO
|
this.mg = new MessageManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUser() {
|
public Message createMessage(String content, Member auth) {
|
||||||
// TODO
|
return this.getMessageManager().createMessage(content, auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMember(Member m) {
|
public void addMessage(Message msg) {
|
||||||
|
this.getLmsg().add(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createUser(String name) {
|
||||||
|
this.addMember(new Member(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addMember(Member m) {
|
||||||
this.getMembers().add(m);
|
this.getMembers().add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,10 +51,12 @@ public class Forum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MessageManager getMessageManager() {
|
public MessageManager getMessageManager() {
|
||||||
return this.messageManager;
|
return this.mg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
private void setMessageManager(MessageManager msgManager) {
|
||||||
|
this.mg = msgManager;
|
||||||
|
}
|
||||||
|
|
||||||
public String getNom() {
|
public String getNom() {
|
||||||
return nom;
|
return nom;
|
||||||
@ -67,4 +66,19 @@ public class Forum {
|
|||||||
this.nom = nom;
|
this.nom = nom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Message> getLmsg() {
|
||||||
|
return this.lmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Message> getLatestmsg(Member m) {
|
||||||
|
List<Message> l = new ArrayList<Message>();
|
||||||
|
for (Message msg : this.getLmsg()) {
|
||||||
|
if(msg.getCreationDate().compareTo(Date.from(Instant.now() )) <= 10) {
|
||||||
|
l.add(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.lireMessage(l);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,16 @@ public class Member {
|
|||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
|
|
||||||
public void envoyerMessage() {
|
public void envoyerMessage(Message m) {
|
||||||
// TODO
|
this.getMsg().add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void effacerMessage() {
|
public boolean effacerMessage(Message m) {
|
||||||
// TODO
|
return this.nom.equalsIgnoreCase(m.getAuthor().getNom());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lireMessage() {
|
public void lireMessage(List<Message> l) {
|
||||||
// TODO
|
System.out.println(l.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNom() {
|
public String getNom() {
|
||||||
@ -50,4 +50,9 @@ public class Member {
|
|||||||
public void setMsg(List<Message> msg) {
|
public void setMsg(List<Message> msg) {
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Membre " + this.getNom() + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Date;
|
|||||||
public class Message {
|
public class Message {
|
||||||
|
|
||||||
private String content;
|
private String content;
|
||||||
private Member destinator;
|
private Member author;
|
||||||
private Date creationDate;
|
private Date creationDate;
|
||||||
|
|
||||||
public Message() {
|
public Message() {
|
||||||
@ -17,12 +17,18 @@ public class Message {
|
|||||||
this(c, null);
|
this(c, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Message(String c, Member d) {
|
public Message(String c, Member a) {
|
||||||
|
//Un message a un contenu et un'e aut'eur'rice
|
||||||
this.content = c;
|
this.content = c;
|
||||||
this.setDestinator(d);
|
this.setAuthor(a);
|
||||||
this.creationDate = Date.from(Instant.now());
|
this.creationDate = Date.from(Instant.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Message de <<" + this.getAuthor() + ">> : " + this.getContent() + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
return this.content;
|
return this.content;
|
||||||
}
|
}
|
||||||
@ -39,11 +45,15 @@ public class Message {
|
|||||||
this.creationDate = creationDate;
|
this.creationDate = creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Member getDestinator() {
|
public Member getAuthor() {
|
||||||
return destinator;
|
return this.author;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestinator(Member destinator) {
|
public void setAuthor(Member author) {
|
||||||
this.destinator = destinator;
|
this.author = author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOutOfDate(int t) {
|
||||||
|
return(this.getCreationDate().compareTo(Date.from(Instant.now())) <= t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,21 @@ package TD1;
|
|||||||
public class MessageManager {
|
public class MessageManager {
|
||||||
|
|
||||||
public MessageManager() {
|
public MessageManager() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
public Message createMessage(String msg, Member auth) {
|
||||||
public void createMessage() {
|
Message m = new Message(msg, auth);
|
||||||
//TODO
|
auth.envoyerMessage(m);
|
||||||
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteMessage() {
|
public boolean deleteMessage(Message msg, Member m) {
|
||||||
//TODO
|
if(m.effacerMessage(msg)) {
|
||||||
|
msg = null;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void posterMessage() {
|
public void posterMessage() {
|
||||||
|
@ -2,82 +2,78 @@ package TD1;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import fr.uca.iut.info.coo.td1.Forum;
|
|
||||||
import fr.uca.iut.info.coo.td1.Member;
|
|
||||||
import fr.uca.iut.info.coo.td1.Message;
|
|
||||||
|
|
||||||
class ForumTest {
|
class ForumTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMainScenario() throws InterruptedException {
|
void testMainScenario() throws InterruptedException {
|
||||||
//L'agence “oogle-stade” (Administrateur) crée un forum “OGCN”.
|
//L'agence “oogle-stade” (Administrateur) crée un forum “OGCN”.
|
||||||
Forum ogcn = new Forum("OGCN");
|
Admin stade = new Admin("oogle-stade", new Forum("OGCN", new MessageManager()));
|
||||||
|
stade.getForum().setAdmin(stade);
|
||||||
|
|
||||||
//Initialisation du Forum avec les membres
|
//Initialisation du Forum avec les membres
|
||||||
Member mario = new Member("Mario");
|
Member mario = new Member("Mario");
|
||||||
Member walter = new Member("Walter");
|
Member walter = new Member("Walter");
|
||||||
Member alban = new Member("Alban");
|
Member alban = new Member("Alban");
|
||||||
ogcn.addMember(mario);
|
stade.getForum().addMember(mario);
|
||||||
ogcn.addMember(walter);
|
stade.getForum().addMember(walter);
|
||||||
ogcn.addMember(alban);
|
stade.getForum().addMember(alban);
|
||||||
List<Member> members = ogcn.getMembers();
|
List<Member> members = stade.getForum().getMembers();
|
||||||
assertEquals(3, members.size());
|
assertEquals(3, members.size());
|
||||||
|
|
||||||
//Mario (Membre) poste un message WaitAndSee: “a quoi cela sert de courir?” sur le forum “OGCN”.
|
//Mario (Membre) poste un message WaitAndSee: “a quoi cela sert de courir?” sur le forum “OGCN”.
|
||||||
Message wait = new Message("a quoi cela sert de courir?", mario);
|
Message wait = stade.getForum().createMessage("a quoi cela sert de courir?", mario);
|
||||||
ogcn.addMessage(wait);
|
stade.getForum().addMessage(wait);
|
||||||
assertEquals(1, ogcn.getAllMessages().size());
|
assertEquals(1, stade.getForum().getLmsg().size());
|
||||||
|
|
||||||
//Walter (Membre) demande s'il y a de nouvelles informations sur le forum et obtient le message WaitAndSee.
|
//Walter (Membre) demande s'il y a de nouvelles informations sur le forum et obtient le message WaitAndSee.
|
||||||
//Il pose la même question un peu plus tard, et le système lui répond qu'il n'y a pas de nouveaux messages.
|
//Il pose la même question un peu plus tard, et le système lui répond qu'il n'y a pas de nouveaux messages.
|
||||||
//Walter demande à lire tous les messages.
|
//Walter demande à lire tous les messages.
|
||||||
//Walter poste un message Yes : “Tout à fait d'accord!”.
|
//Walter poste un message Yes : “Tout à fait d'accord!”.
|
||||||
List<Message> messages = ogcn.getNewMessages(walter);
|
List<Message> messages = stade.getForum().getLatestmsg(walter);
|
||||||
assertTrue(messages.contains(wait));
|
assertTrue(messages.contains(wait));
|
||||||
messages = ogcn.getNewMessages(walter);
|
messages = stade.getForum().getLatestmsg(walter);
|
||||||
assertEquals(0,messages.size());
|
assertEquals(0, messages.size());
|
||||||
assertEquals(1, ogcn.getAllMessages().size());
|
assertEquals(1, stade.getForum().getLmsg().size());
|
||||||
Message yes = new Message( "Tout à fait d'accord!", walter);
|
Message yes = stade.getForum().createMessage("Tout à fait d'accord!", walter);
|
||||||
ogcn.addMessage(yes);
|
stade.getForum().addMessage(yes);
|
||||||
|
|
||||||
|
|
||||||
//Alban (Membre) demande s'il y a de nouveaux messages et obtient les messages WaitAndSee and Yes.
|
//Alban (Membre) demande s'il y a de nouveaux messages et obtient les messages WaitAndSee and Yes.
|
||||||
messages = ogcn.getNewMessages(alban);
|
messages = stade.getForum().getLatestmsg(alban);
|
||||||
assertTrue(messages.contains(wait));
|
assertTrue(messages.contains(wait));
|
||||||
assertTrue(messages.contains(yes));
|
assertTrue(messages.contains(yes));
|
||||||
|
|
||||||
//Youcef s'inscrit sur le forum puis poste un message PFFF : “Vous rigolez?”.
|
//Youcef s'inscrit sur le forum puis poste un message PFFF : “Vous rigolez?”.
|
||||||
Member youcef = new Member("Youcef");
|
Member youcef = new Member("Youcef");
|
||||||
ogcn.addMember(youcef);
|
stade.getForum().addMember(youcef);
|
||||||
Message pfff = new Message( "Vous rigolez?", youcef);
|
Message pfff = stade.getForum().createMessage("Vous rigolez?", youcef);
|
||||||
ogcn.addMessage(pfff);
|
stade.getForum().addMessage(pfff);
|
||||||
messages = ogcn.getNewMessages(youcef);
|
messages = stade.getForum().getLatestmsg(youcef);
|
||||||
assertEquals(3, messages.size());
|
assertEquals(3, messages.size());
|
||||||
messages = ogcn.getNewMessages(youcef);
|
messages = stade.getForum().getLatestmsg(youcef);
|
||||||
assertEquals(0, messages.size());
|
assertEquals(0, messages.size());
|
||||||
|
|
||||||
//Walter demande à lire les nouveaux messages.
|
//Walter demande à lire les nouveaux messages.
|
||||||
messages = ogcn.getNewMessages(walter);
|
messages = stade.getForum().getLatestmsg(walter);
|
||||||
assertEquals(2, messages.size());
|
assertEquals(2, messages.size());
|
||||||
|
|
||||||
//Walter demande à effacer le message réalisé par Youcef, il n'a pas le droit, cela ne fait rien.
|
//Walter demande à effacer le message réalisé par Youcef, il n'a pas le droit, cela ne fait rien.
|
||||||
messages = ogcn.getAllMessages();
|
messages = stade.getForum().getLmsg();
|
||||||
int numberOfMessages = messages.size();
|
int numberOfMessages = messages.size();
|
||||||
|
|
||||||
boolean removed = ogcn.remove(pfff, walter);
|
boolean removed = stade.getForum().getMessageManager().deleteMessage(pfff, walter);
|
||||||
assertFalse(removed);
|
assertFalse(removed);
|
||||||
messages = ogcn.getAllMessages();
|
messages = stade.getForum().getLmsg();
|
||||||
assertEquals(numberOfMessages,messages.size());
|
assertEquals(numberOfMessages,messages.size());
|
||||||
|
|
||||||
//Youcef efface son message
|
//Youcef efface son message
|
||||||
removed = ogcn.remove(pfff, youcef);
|
removed = stade.getForum().getMessageManager().deleteMessage(pfff, youcef);
|
||||||
assertTrue(removed);
|
assertTrue(removed);
|
||||||
messages = ogcn.getAllMessages();
|
messages = stade.getForum().getLmsg();
|
||||||
assertEquals(numberOfMessages-1,messages.size(),"le message a bien été effacé");
|
assertEquals(numberOfMessages-1,messages.size(),"le message a bien été effacé");
|
||||||
|
|
||||||
assertFalse(pfff.isOutOfDate(2));
|
assertFalse(pfff.isOutOfDate(2));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user