bug3484 created test method for 'getAssociationPairingList'

This commit is contained in:
Raphael Müßeler committed 2017-10-25 09:27:03 +02:00
1 parent f130eba427
commit cf3ea719e7
3 files changed
+48 -15

No files matched your search

@@ -0,0 +1,9 @@
package com.sap.sailing.domain.base;
import com.sap.sse.pairinglist.PairingFrameProvider;
public interface PairingListRegattaAdapter<Flight, Group, Competitor> extends PairingFrameProvider<Flight, Group, Competitor> {
}
@@ -1,29 +1,52 @@
package com.sap.see.pairinglist.test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.security.acl.Group;
import org.junit.Before;
import org.junit.Test;
import com.sap.sse.pairinglist.impl.PairingListTemplateImpl;
import junit.framework.Assert;
public class PairingListTest<Flight, Group, Competitor> {
PairingListTemplateImpl<Flight, Group, Competitor> aImpl;
@Before
public void init() {
this.aImpl = new PairingListTemplateImpl<Flight, Group, Competitor>();
// creating pairing list template
this.aImpl.create(15, 3, 18);
}
@Test
public void testPairingListCreation() {
aImpl=new PairingListTemplateImpl<>();
int[][] temp=aImpl.create(15, 3, 18);
assertNotNull(temp);
for(int[] i:temp){
for (int z: i){
if(z<=0) fail("Problem in .create!");
}
}
}
@Test
public void testPairingListCreation() {
int[][] plTemplate = this.aImpl.getPairingListTemplate();
Assert.assertNotNull(plTemplate);
for(int[] i:plTemplate){
for (int z: i){
if(z<=0) Assert.fail("Problem in .create!");
}
}
}
@Test
public void testTeamAssociationCreation() {
int[][] plTemplate = this.aImpl.getPairingListTemplate();
int[][] associations = new int[18][18];
this.aImpl.getAssociationsFromPairingList(plTemplate, associations);
for (int x = 0; x < associations.length; x++) {
for (int y = 0; y < associations[0].length; y++) {
if ((x == y) && (associations[x][y] != -1)) {
Assert.fail("In 'getAssociationsFromPairingList' the diagonal of association matrix has to be -1.");
}
}
}
}
}
+1
View File
@@ -10,6 +10,7 @@ Export-Package: com.sap.sse,
com.sap.sse.i18n,
com.sap.sse.i18n.impl,
com.sap.sse.osgi,
com.sap.sse.pairinglist,
com.sap.sse.qrcode,
com.sap.sse.util,
com.sap.sse.util.graph,