Commit 721929cf authored by Mohamad Bashar Desoki's avatar Mohamad Bashar Desoki

Create Save Student Service

parent 426d96c5
......@@ -11,7 +11,7 @@ target/
*.iws
*.iml
*.ipr
.idea/*.xml
.idea/
### Eclipse ###
.apt_generated
......
......@@ -4,41 +4,79 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="6c1c1ef0-2a41-4015-9b74-a0b70a17938b" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<list default="true" id="58d4b7b2-63a8-4164-95ff-e494b5fc28c6" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/main/java/Student.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/StudentService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/test/java/StudentServiceTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="2WtojctnFodHRVo1eRr4RdUUYTx" />
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2WtzzJA6EkVb6eqVoUQpRGaY50v" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/HIAST Library/Teaching/PP/2024/lec1/Lec1-Threads&quot;
}
}]]></component>
}</component>
<component name="RunManager" selected="JUnit.StudentServiceTest.testStudentService">
<configuration name="StudentServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="Lec1-Threads" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="StudentServiceTest" />
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="StudentServiceTest.testStudentService" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="Lec1-Threads" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="StudentServiceTest" />
<option name="METHOD_NAME" value="testStudentService" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="JUnit.StudentServiceTest.testStudentService" />
<item itemvalue="JUnit.StudentServiceTest" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="6c1c1ef0-2a41-4015-9b74-a0b70a17938b" name="Changes" comment="" />
<created>1697561376046</created>
<changelist id="58d4b7b2-63a8-4164-95ff-e494b5fc28c6" name="Changes" comment="" />
<created>1697610341846</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1697561376046</updated>
<updated>1697610341846</updated>
</task>
<servers />
</component>
......
public class Student {
private String name;
public Student(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
import java.util.UUID;
public class StudentService {
public String SaveStudent(Student student){
System.out.println("Save new Student: "+student.getName());
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return UUID.randomUUID().toString();
}
}
import junit.framework.TestCase;
public class StudentServiceTest extends TestCase {
public void testStudentService()
{
long StartTime= System.currentTimeMillis();
Student student = new Student("Mhd");
StudentService svc = new StudentService();
svc.SaveStudent(student);
long end = System.currentTimeMillis()- StartTime;
System.out.println("Time Taken: "+ end);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment