<?xml version="1.0" encoding="UTF-8"?> | |||||
<module type="JAVA_MODULE" version="4"> | |||||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |||||
<exclude-output /> | |||||
<content url="file://$MODULE_DIR$"> | |||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |||||
</content> | |||||
<orderEntry type="inheritedJdk" /> | |||||
<orderEntry type="sourceFolder" forTests="false" /> | |||||
<orderEntry type="library" name="jars" level="project" /> | |||||
</component> | |||||
</module> |
<component name="JavaScriptSettings"> | <component name="JavaScriptSettings"> | ||||
<option name="languageLevel" value="ES6" /> | <option name="languageLevel" value="ES6" /> | ||||
</component> | </component> | ||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="10" project-jdk-type="JavaSDK"> | |||||
<output url="file://$USER_HOME$/gitchareswe" /> | |||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="true" project-jdk-name="10" project-jdk-type="JavaSDK"> | |||||
<output url="file://$PROJECT_DIR$/../gitchareswe" /> | |||||
</component> | </component> | ||||
</project> | </project> |
<project version="4"> | <project version="4"> | ||||
<component name="ProjectModuleManager"> | <component name="ProjectModuleManager"> | ||||
<modules> | <modules> | ||||
<module fileurl="file://$PROJECT_DIR$/.idea/ChareSWE.iml" filepath="$PROJECT_DIR$/.idea/ChareSWE.iml" /> | |||||
<module fileurl="file://$PROJECT_DIR$/ChareSWE.iml" filepath="$PROJECT_DIR$/ChareSWE.iml" /> | |||||
</modules> | </modules> | ||||
</component> | </component> | ||||
</project> | </project> |
public Person owner; | public Person owner; | ||||
public String email; | public String email; | ||||
Account(Person owner, String email){ | |||||
this.owner = owner; | |||||
this.email = email; | |||||
} | |||||
public void accountErstellen(Person p, String e_email){ | public void accountErstellen(Person p, String e_email){ | ||||
this.owner = p; | |||||
this.email = e_email; | |||||
} | } | ||||
public void testTwo(){ | public void testTwo(){ | ||||
Credentials c = new Credentials("hofmannol", "GERONIMO"); | Credentials c = new Credentials("hofmannol", "GERONIMO"); | ||||
assertTrue(c.valid()); | |||||
assertEquals("hofmannol", c.login); | |||||
} | } | ||||
@Test | @Test |
public int age; | public int age; | ||||
Person(String name, String vname, int age){ | Person(String name, String vname, int age){ | ||||
this.name = name; | this.name = name; | ||||
this.vname = vname; | this.vname = vname; | ||||
this.age = age; | this.age = age; |
private int amount; | private int amount; | ||||
public Spender (String fname, String lname, int age, int summe){ | public Spender (String fname, String lname, int age, int summe){ | ||||
super(fname, lname, age); | super(fname, lname, age); | ||||
this.amount = summe; | this.amount = summe; | ||||
} | } | ||||
public void betragSetzen(int summe){ | public void betragSetzen(int summe){ | ||||
if(summe > 0){ | if(summe > 0){ | ||||
amount = summe; | amount = summe; | ||||
} | } | ||||
} | } | ||||
public int getAmount(){ | public int getAmount(){ | ||||
return amount; | return amount; | ||||
} | } | ||||
import org.junit.Test; | |||||
import static org.junit.Assert.*; | |||||
public class TestAccount { | |||||
@Test | |||||
public void test1(){ | |||||
// Arrange | |||||
Person p = new Person("Hans","Georg", 12); | |||||
// Act | |||||
Account a = new Account(p, "fdfdf"); | |||||
// Assert | |||||
assertEquals("Georg", a.owner.vname); | |||||
} | |||||
@Test | |||||
public void testM2(){ | |||||
// Arrange | |||||
Person p = new Person("Hans","Georg", 12); | |||||
// Act | |||||
Account a = new Account(p, "fdfdf"); | |||||
// Assert | |||||
assertEquals("Georg", a.owner.vname); | |||||
} | |||||
@Test | |||||
public void test3(){ | |||||
// Arrange | |||||
Person p = new Person("Hans","Georg", 12); | |||||
// Act | |||||
Account a = new Account(p, "fdfdf"); | |||||
// Assert | |||||
assertEquals(12, a.owner.age); | |||||
} | |||||
} |
} | } | ||||
} | } |