Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added lib/apiguardian-api-1.0.0.jar
Binary file not shown.
Binary file added lib/javax.annotation.jar
Binary file not shown.
Binary file added lib/javax.ejb.jar
Binary file not shown.
Binary file added lib/javax.jms.jar
Binary file not shown.
Binary file added lib/javax.persistence.jar
Binary file not shown.
Binary file added lib/javax.resource.jar
Binary file not shown.
Binary file added lib/javax.servlet.jar
Binary file not shown.
Binary file added lib/javax.servlet.jsp.jar
Binary file not shown.
Binary file added lib/javax.servlet.jsp.jstl.jar
Binary file not shown.
Binary file added lib/javax.transaction.jar
Binary file not shown.
Binary file added lib/junit-jupiter-api-5.0.0.jar
Binary file not shown.
Binary file added lib/junit-platform-commons-1.0.0.jar
Binary file not shown.
Binary file added lib/opentest4j-1.0.0.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions org/jboss/arquillian/container/test/api/annotations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<root>
<item name='org.jboss.arquillian.container.test.api.Deployment'>
<annotation name='java.lang.Deprecated'/>
</item>
</root>
5 changes: 5 additions & 0 deletions org/junit/runner/annotations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<root>
<item name='org.junit.runner.RunWith'>
<annotation name='java.lang.Deprecated'/>
</item>
</root>
7 changes: 7 additions & 0 deletions src/main/java/nl/noorderzon/functies/Reservation.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Reservation {
private int capacity;
private boolean validReservation;
private int voorstelling = 1;
private int quant_res;

private static EntityManagerFactory emf =
Persistence.createEntityManagerFactory("nl.noorderzon.hibernate");
Expand All @@ -30,9 +31,15 @@ public class Reservation {
*/
public Reservation(int quant_res) {
Calculate(quant_res);
this.quant_res = quant_res;
System.out.println("ValidReservation = " + validReservation);
System.out.println("Capacity = " + capacity);
updateCapaciteit();

}

public int getQuant_res() {
return quant_res;
}

// Main aangemaakt om te testen
Expand Down
80 changes: 70 additions & 10 deletions src/main/java/nl/noorderzon/functies/ReservationTest.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,82 @@
package nl.noorderzon.functies;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

class ReservationTest {
/**The test class ReservationTest**/

// om de if-else statement te testen worden voor de beide condities een test gemaakt.
@Test
public void calculateStatementOne() {
assertTrue();
public class ReservationTest {
private Reservation res1;
private Reservation res2;
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final PrintStream originalOut = System.out;
private int capacity;

/**
* Constructor for the test class
**/

public ReservationTest(){
}

/*
* Set up the test reservations
* Called before every test method
*/

@Before
public void setUp() {
res1 = new Reservation(5);
res2 = new Reservation(2);
capacity = 500;
}

public void setUpStreams() {
System.setOut(new PrintStream(outContent));
}

/*
Tears down the test setup.
Method called after every test
*/

@After
public void tearDown(){
}
public void restoreStreams() {
System.setOut(originalOut);
}

/**
* Test that a reservation item is correctly initialised (quantity).
*/
@Test
void getCapacity() {
public void testInit() {
Reservation res1 = new Reservation(5);
assertEquals(5, res1.getQuant_res());
}


@Test
void isValidReservation() {
public void out() {
System.out.print("ValidReservation");
assertEquals("ValidReservation", outContent.toString());
}
}

// als er vrijdag nog tijd is dan deze nog uitwerken
/* @Test
public void testCalculate1(){
Reservation res1 = new Reservation(4);
capacity = capacity - getQuant_res;
assertEquals(true, )
}*/



}