[POO Note]

- Explication de certaines partie du code
- Détails concernant la modification du sujet/des tests unitaires
This commit is contained in:
Tanguy Herbron 2018-11-30 18:17:47 +01:00
parent e49cb5cc75
commit da15ad375b
8 changed files with 234 additions and 144 deletions

View File

@ -2,7 +2,13 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="619befff-b456-45da-9393-c820ac461b67" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/entity/Administrateur.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/entity/Administrateur.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/entity/Agence.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/entity/Agence.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/entity/Empruntable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/entity/Empruntable.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/entity/Emprunteur.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/entity/Emprunteur.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/entity/Entreprise.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/entity/Entreprise.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/AdministrateurTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/AdministrateurTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/EmprunteurTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/EmprunteurTest.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<ignored path="$PROJECT_DIR$/target/" />
@ -22,25 +28,25 @@
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="7002" />
<entry key="java" value="9255" />
<entry key="xml" value="8" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="7002" />
<entry key="JAVA" value="9255" />
<entry key="XML" value="8" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="java" value="58" />
<entry key="java" value="60" />
<entry key="xml" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="JAVA" value="58" />
<entry key="JAVA" value="60" />
<entry key="XML" value="1" />
</counts>
</usages-collector>
@ -51,8 +57,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/test/java/AdministrateurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2771">
<caret line="175" column="64" selection-start-line="175" selection-start-column="64" selection-end-line="175" selection-end-column="64" />
<state relative-caret-position="162">
<caret line="72" column="4" selection-start-line="72" selection-start-column="4" selection-end-line="72" selection-end-column="4" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -84,8 +90,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Emprunteur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="28" column="5" selection-start-line="28" selection-start-column="5" selection-end-line="28" selection-end-column="5" />
<state relative-caret-position="177">
<caret line="13" selection-start-line="13" selection-end-line="13" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#162#163#0" expanded="true" />
@ -100,10 +106,24 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Entreprise.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="155">
<caret line="27" selection-start-line="27" selection-end-line="27" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#451#452#0" expanded="true" />
<element signature="e#482#483#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/test/java/EmprunteurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="25" selection-start-line="14" selection-start-column="25" selection-end-line="14" selection-end-column="25" />
<state relative-caret-position="155">
<caret line="26" lean-forward="true" selection-start-line="26" selection-end-line="26" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#425#426#0" expanded="true" />
@ -129,8 +149,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Empruntable.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="36" selection-start-line="12" selection-start-column="36" selection-end-line="12" selection-end-column="36" />
<state relative-caret-position="-95">
<caret line="1" selection-start-line="1" selection-end-line="1" />
<folding>
<element signature="e#285#286#0" expanded="true" />
<element signature="e#329#330#0" expanded="true" />
@ -146,8 +166,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Administrateur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="39" column="29" selection-start-line="39" selection-start-column="29" selection-end-line="39" selection-end-column="29" />
<state relative-caret-position="94">
<caret line="82" selection-start-line="82" selection-end-line="82" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2369#2370#0" expanded="true" />
@ -163,11 +183,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Agence.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="49" column="34" lean-forward="true" selection-start-line="49" selection-start-column="34" selection-end-line="49" selection-end-column="34" />
<state relative-caret-position="155">
<caret line="19" selection-start-line="19" selection-end-line="19" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#325#326#0" expanded="true" />
@ -179,22 +199,6 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Entreprise.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="25" column="23" selection-start-line="25" selection-start-column="23" selection-end-line="25" selection-end-column="23" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#451#452#0" expanded="true" />
<element signature="e#482#483#0" expanded="true" />
<element signature="e#530#531#0" expanded="true" />
<element signature="e#560#561#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -232,16 +236,17 @@
<option value="$PROJECT_DIR$/src/main/java/material/Souris.java" />
<option value="$PROJECT_DIR$/src/main/java/material/TELPortable.java" />
<option value="$PROJECT_DIR$/src/main/java/material/VideoProjecteur.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Entreprise.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Empruntable.java" />
<option value="$PROJECT_DIR$/src/test/java/AdministrateurTest.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Agence.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Emprunteur.java" />
<option value="$PROJECT_DIR$/src/test/java/EmprunteurTest.java" />
<option value="$PROJECT_DIR$/src/test/java/AgenceTest.java" />
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/src/main/java/entity/Administrateur.java" />
<option value="$PROJECT_DIR$/src/main/java/material/UC.java" />
<option value="$PROJECT_DIR$/src/main/java/Runner.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Administrateur.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Agence.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Empruntable.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Emprunteur.java" />
<option value="$PROJECT_DIR$/src/main/java/entity/Entreprise.java" />
<option value="$PROJECT_DIR$/src/test/java/AdministrateurTest.java" />
<option value="$PROJECT_DIR$/src/test/java/EmprunteurTest.java" />
</list>
</option>
</component>
@ -322,7 +327,7 @@
</panes>
</component>
<component name="PropertiesComponent">
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1543597432818" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1543598214714" />
</component>
<component name="RecentsManager">
<key name="CreateClassDialog.RecentsKey">
@ -442,7 +447,7 @@
<window_info id="Capture Tool" order="2" />
<window_info id="Favorites" order="3" side_tool="true" />
<window_info id="Image Layers" order="4" />
<window_info active="true" content_ui="combo" id="Project" order="5" visible="true" weight="0.24948454" />
<window_info content_ui="combo" id="Project" order="5" visible="true" weight="0.24948454" />
<window_info id="Structure" order="6" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Terminal" order="0" />
<window_info anchor="bottom" id="Event Log" order="1" side_tool="true" />
@ -450,11 +455,11 @@
<window_info anchor="bottom" id="Version Control" order="3" />
<window_info anchor="bottom" id="Message" order="4" />
<window_info anchor="bottom" id="Find" order="5" />
<window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.32897863" />
<window_info anchor="bottom" id="Run" order="6" weight="0.32897863" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="10" weight="0.32897863" />
<window_info active="true" anchor="bottom" id="TODO" order="10" visible="true" weight="0.32897863" />
<window_info anchor="right" id="Capture Analysis" order="0" />
<window_info anchor="right" id="Theme Preview" order="1" />
<window_info anchor="right" id="Palette&#9;" order="2" />
@ -562,73 +567,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Entreprise.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="25" column="23" selection-start-line="25" selection-start-column="23" selection-end-line="25" selection-end-column="23" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#451#452#0" expanded="true" />
<element signature="e#482#483#0" expanded="true" />
<element signature="e#530#531#0" expanded="true" />
<element signature="e#560#561#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Empruntable.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="36" selection-start-line="12" selection-start-column="36" selection-end-line="12" selection-end-column="36" />
<folding>
<element signature="e#285#286#0" expanded="true" />
<element signature="e#329#330#0" expanded="true" />
<element signature="e#373#374#0" expanded="true" />
<element signature="e#406#407#0" expanded="true" />
<element signature="e#447#448#0" expanded="true" />
<element signature="e#480#481#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/EmprunteurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="25" selection-start-line="14" selection-start-column="25" selection-end-line="14" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#425#426#0" expanded="true" />
<element signature="e#462#463#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/AdministrateurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2771">
<caret line="175" column="64" selection-start-line="175" selection-start-column="64" selection-end-line="175" selection-end-column="64" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Emprunteur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="28" column="5" selection-start-line="28" selection-start-column="5" selection-end-line="28" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#162#163#0" expanded="true" />
<element signature="e#214#215#0" expanded="true" />
<element signature="e#375#376#0" expanded="true" />
<element signature="e#420#421#0" expanded="true" />
<element signature="e#472#473#0" expanded="true" />
<element signature="e#500#501#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/AgenceTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="364">
@ -639,24 +577,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Administrateur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="39" column="29" selection-start-line="39" selection-start-column="29" selection-end-line="39" selection-end-column="29" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2369#2370#0" expanded="true" />
<element signature="e#2426#2427#0" expanded="true" />
<element signature="e#2485#2486#0" expanded="true" />
<element signature="e#2538#2539#0" expanded="true" />
<element signature="e#2610#2611#0" expanded="true" />
<element signature="e#2663#2664#0" expanded="true" />
<element signature="e#3380#3381#0" expanded="true" />
<element signature="e#3434#3435#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
@ -675,10 +595,35 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/Runner.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="8" selection-start-line="4" selection-start-column="8" selection-end-line="4" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Administrateur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="94">
<caret line="82" selection-start-line="82" selection-end-line="82" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2369#2370#0" expanded="true" />
<element signature="e#2426#2427#0" expanded="true" />
<element signature="e#2485#2486#0" expanded="true" />
<element signature="e#2538#2539#0" expanded="true" />
<element signature="e#2610#2611#0" expanded="true" />
<element signature="e#2663#2664#0" expanded="true" />
<element signature="e#3380#3381#0" expanded="true" />
<element signature="e#3434#3435#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Agence.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="49" column="34" lean-forward="true" selection-start-line="49" selection-start-column="34" selection-end-line="49" selection-end-column="34" />
<state relative-caret-position="155">
<caret line="19" selection-start-line="19" selection-end-line="19" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#325#326#0" expanded="true" />
@ -689,9 +634,134 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Empruntable.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-95">
<caret line="1" selection-start-line="1" selection-end-line="1" />
<folding>
<element signature="e#285#286#0" expanded="true" />
<element signature="e#329#330#0" expanded="true" />
<element signature="e#373#374#0" expanded="true" />
<element signature="e#406#407#0" expanded="true" />
<element signature="e#447#448#0" expanded="true" />
<element signature="e#480#481#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Emprunteur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="177">
<caret line="13" selection-start-line="13" selection-end-line="13" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#162#163#0" expanded="true" />
<element signature="e#214#215#0" expanded="true" />
<element signature="e#375#376#0" expanded="true" />
<element signature="e#420#421#0" expanded="true" />
<element signature="e#472#473#0" expanded="true" />
<element signature="e#500#501#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/entity/Entreprise.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="155">
<caret line="27" selection-start-line="27" selection-end-line="27" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#451#452#0" expanded="true" />
<element signature="e#482#483#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/AdministrateurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="162">
<caret line="72" column="4" selection-start-line="72" selection-start-column="4" selection-end-line="72" selection-end-column="4" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/EmprunteurTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="155">
<caret line="26" lean-forward="true" selection-start-line="26" selection-end-line="26" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#425#426#0" expanded="true" />
<element signature="e#462#463#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>POOtpnote</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
@ -704,6 +774,18 @@
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<last-edited>Maven: junit:junit:4.12</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -15,7 +15,10 @@ public class Administrateur extends Employe {
LOG.debug("Création d'un administrateur");
}
//TODO Expliquer le fonctionnement de la méthode en détail
//La méthode attribuerMateriel fonctionne de la manière suivante :
//Si l'empruntable n'a aucune limitation, on retourne le succès ou l'échec de l'ajout à la liste du stock.
//Si une limitation est présente, on vérifie d'abord si l'emprunteur est bien une entreprise ou un agent.
//Ensuite on retourne le succès ou l'échec de l'ajout à la liste stock.
public boolean attribuerMateriel(Empruntable empruntable, Emprunteur emprunteur)
{
if(empruntable.isLimitationPretAuxAgence())
@ -63,7 +66,10 @@ public class Administrateur extends Employe {
return agence.listeMateriel();
}
//TODO Détailler cette méthode
//On vérifie d'abord si le premier emprunteur possède bien l'empruntable qu'il faut transférer
//Si l'attribution à l'autre emprunteur est validée, on enlève le matériel de l'envoyeur
//Cela évite de transférer un empruntable si la cible n'a pas les autorisations d'avoir cet objet
//Ex : Un empruntable avec limitation ne peut pas aller à un employé
public void transfererMateriel(Emprunteur emprunteurSend, Empruntable empruntable, Emprunteur emprunteurReceive)
{
if(emprunteurSend.listeMateriel().contains(empruntable))
@ -75,8 +81,8 @@ public class Administrateur extends Employe {
}
}
//TODO Détailler pourquoi passer parmis les employés de l'agence ET de l'entreprise (SS2I)
//TODO Peut-être passer par toutes les agences de l'entreprise ?
//On supprime le matériel de l'intégralité de l'entreprise, donc aussi de chaque agence et de chaque employé de l'entreprise ainsi que de chaque agence.
//On vérifie bien que le matériel est supprimé de toutes les agences indépendamment des entreprises (en cas de membres provenant d'SS2I)
public void supprimerMateriel(Empruntable empruntable)
{
entreprise.perdreMateriel(empruntable);

View File

@ -18,7 +18,7 @@ public class Agence extends Emprunteur implements Comparable<Agence> {
return employes;
}
//TODO Détailler l'ajout de l'ENSEMBLE des stocks
//Le matériel d'une agence est constitué du matériel de l'agence ainsi que du matériel de chaque employé de la dite agence.
@Override
public List<Empruntable> listeMateriel()
{

View File

@ -1,6 +1,6 @@
package entity;
//TODO Préciser pourquoi un package entity a été créé (héritage du matériel)
//Un package entity a été créé pour que les objets du package material puissent bien hérité d'empruntable
public class Empruntable {
private boolean limitationPretAuxAgence;

View File

@ -12,7 +12,9 @@ public class Emprunteur{
stock = new ArrayList<Empruntable>();
}
//TODO Amélioration de la méthode, préciser pourquoi utiliser un boolean plutôt qu'un void
//La méthode est ici amélioréé par rapport au sujet.
//J'utilise le retour de la méthode add de List comme valeur de retour.
//La méthode add retourne true si l'ajout a bien été effectué, false sinon.
public boolean ajouterAuStock(Empruntable empruntable)
{
return stock.add(empruntable);

View File

@ -26,7 +26,7 @@ public class Entreprise extends Emprunteur {
return agences;
}
//TODO Détailler l'ajout de l'ENSEMBLE des stocks
//Le stock d'une entreprise est composé du stock de l'entreprise, du stock de chaque agence ainsi que de chaque employé de l'entreprise
@Override
public List<Empruntable> listeMateriel()
{

View File

@ -70,7 +70,8 @@ public class AdministrateurTest {
}
//TODO Détailler modification par rapport au stock entreprise/administrateur (passage d'un stockage chez l'admin à un stockage dans l'entreprise)
//J'ai ici modifié le test unitaire pour que l'on vérifie le stock de l'entreprise et non de l'administrateur.
//Il me semblait plus logique que lors de la récupération du matériel, ce soit l'entreprise qui le récupère plutôt que l'admin ramèune ça chez lui.
@Test
public void recupererMateriel() {
int stockActuel = admin.listeMateriel().size();

View File

@ -9,8 +9,6 @@ import org.junit.Test;
import java.util.ArrayList;
//TODO Ajouter Log4J
public class EmprunteurTest {
static Emprunteur e1;
@ -27,7 +25,8 @@ public class EmprunteurTest {
Assert.assertEquals("ajouterAuStock: fail", stock+1, e1.listeMateriel().size());
}
//TODO Expliquer la modifification du test unitaire
//J'ai ici modifié le test unitaire car mes stocks sont initialisés à la création de mes entreprises.
//J'utilise aussi la méthode ajouterAuStock plutôt que la méthode générique add parce que ma variable stock est privée.
@Test
public void listeMateriel() {
//e1.stock = new ArrayList<Empruntable>();