mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 22:37:15 +00:00
Bug3199: Generic changes and unitTest
This commit is contained in:
1 parent
af2cb8fdcc
commit
731b97d054
3 files changed
+82
-17
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
package com.sap.sailing.domain.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.DomainFactoryImpl;
|
||||
|
||||
public class DomainFactoryImplTest {
|
||||
DomainFactoryImpl domainFactory;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
domainFactory = new DomainFactoryImpl(DomainFactory.INSTANCE);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestNullCollection() {
|
||||
Assert.assertEquals(null, domainFactory.getDominantBoatClass(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestEmptyCollection() {
|
||||
ArrayList<String> emptyList = new ArrayList<String>();
|
||||
Assert.assertEquals(null, domainFactory.getDominantBoatClass(emptyList));
|
||||
}
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestWithOneObject() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("LSR");
|
||||
Assert.assertEquals("Laser Int.", domainFactory.getDominantBoatClass(list).getDisplayName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestWithTheSameCount() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("LSR");
|
||||
list.add("18.Footer");
|
||||
String result = domainFactory.getDominantBoatClass(list).getDisplayName();
|
||||
if(!(result == "Laser Int." || result == "18Footer")) {
|
||||
Assert.assertEquals("Laser Int.", result);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestWithMoreThanOneObject() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("LSR");
|
||||
list.add("18.Footer");
|
||||
list.add("LSR");
|
||||
String result = domainFactory.getDominantBoatClass(list).getDisplayName();
|
||||
Assert.assertEquals("Laser Int.", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDominantBoatClass_TestWithSynonymNames() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("LSR");
|
||||
list.add("18.Footer");
|
||||
list.add("18.Footer");
|
||||
list.add("Laser Int.");
|
||||
list.add("Laser");
|
||||
String result = domainFactory.getDominantBoatClass(list).getDisplayName();
|
||||
Assert.assertEquals("Laser Int.", result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user