Skip to content

Instantly share code, notes, and snippets.

@RaymondKroon
Last active August 29, 2015 14:20
Show Gist options
  • Save RaymondKroon/8c7b9306dbbfe86dbae8 to your computer and use it in GitHub Desktop.
Save RaymondKroon/8c7b9306dbbfe86dbae8 to your computer and use it in GitHub Desktop.
getter/setter test
package nl.pdok.datamanagement.model;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import nl.pdok.datamanagement.enumeration.ErrorHandling;
import org.junit.Test;
public class DatasetTest {
public static class Dataset extends Dataset {
private static final long serialVersionUID = 1L;
}
public static class Delivery extends Delivery {
private static final long serialVersionUID = -8547264657696789492L;
@Override
protected void createUpdatesAndExtracts(Dataset dataset) {
// TODO Auto-generated method stub
}
@Override
protected Dataset getDataset() {
// TODO Auto-generated method stub
return null;
}
@Override
protected void beforeProcess() {
// TODO Auto-generated method stub
}
@Override
protected void afterProcess() {
// TODO Auto-generated method stub
}
}
@Test
public void testDataset() {
Dataset dataset = new Dataset();
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeId() {
Dataset dataset = new Dataset();
dataset.setId(1);
assertEquals(1, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeName() {
Dataset dataset = new Dataset();
dataset.setName("test");
assertEquals(0, dataset.getId());
assertEquals("test", dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeInternalWarehouseLocation() {
Dataset dataset = new Dataset();
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeTiled() {
Dataset dataset = new Dataset();
dataset.setHasTilingServices(true);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertTrue(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeProcessedAutomatically() {
Dataset dataset = new Dataset();
dataset.setProcessedAutomatically(true);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertTrue(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeErrorHandling() {
Dataset dataset = new Dataset();
dataset.setErrorHandling(ErrorHandling.IGNORE);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertEquals(ErrorHandling.IGNORE, dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeMaxNrOfErrors() {
Dataset dataset = new Dataset();
dataset.setMaxNrOfErrors("test");
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertEquals("test", dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeWorkbenches() {
Dataset dataset = new Dataset();
Set<Workbench> workbenches = new HashSet<Workbench>();
workbenches.add(new Workbench());
dataset.setWorkbenches(workbenches);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(1, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeTilingConfigurations() {
Dataset dataset = new Dataset();
Set<TilingConfiguration> tilingConfigurations = new HashSet<TilingConfiguration>();
tilingConfigurations.add(new TilingConfiguration());
dataset.setTilingConfigurations(tilingConfigurations);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(1, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeDeliveries() {
Dataset dataset = new Dataset();
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeBaseDataset() {
Dataset dataset = new Dataset();
dataset.setBaseDataset(new Dataset());
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNotNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(0, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
@Test
public void testAttributeDerivativeDatasets() {
Dataset dataset = new Dataset();
Set<Dataset> derivativeDatasets = new HashSet<Dataset>();
derivativeDatasets.add(new Dataset());
dataset.setDerivativeDatasets(derivativeDatasets);
assertEquals(0, dataset.getId());
assertNull(dataset.getName());
assertNull(dataset.getHasTilingServices());
assertFalse(dataset.getHasExtracts());
assertNull(dataset.getHasLuceneIndexes());
assertNull(dataset.getProcessedAutomatically());
assertNull(dataset.getErrorHandling());
assertNull(dataset.getMaxNrOfErrors());
assertNotNull(dataset.getWorkbenches());
assertEquals(0, dataset.getWorkbenches().size());
assertNotNull(dataset.getTilingConfigurations());
assertEquals(0, dataset.getTilingConfigurations().size());
assertNull(dataset.getBaseDataset());
assertNotNull(dataset.getDerivativeDatasets());
assertEquals(1, dataset.getDerivativeDatasets().size());
assertEquals(0, dataset.getMetadataSets().size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment