Project

General

Profile

Revision e5912296

IDe59122961ca91b62692ff003b9b8644661517d1b
Parent e08ad769
Child 69e3d783

Added by Andreas Kohlbecker over 2 years ago

moving AlternativeUnitilsJUnit4TestClassRunner to cdmlib-test

View differences:

src/test/java/unitils/AlternativeUnitilsJUnit4TestClassRunner.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package unitils;
10

  
11
import java.io.IOException;
12
import java.io.InputStream;
13

  
14
import org.junit.internal.runners.InitializationError;
15
import org.junit.runner.notification.RunNotifier;
16
import org.unitils.UnitilsJUnit4TestClassRunner;
17

  
18
/**
19
 * A runner which enables all vaadin UIs for the tests
20
 *
21
 * @author a.kohlbecker
22
 * @since Nov 23, 2017
23
 *
24
 */
25
public class AlternativeUnitilsJUnit4TestClassRunner extends UnitilsJUnit4TestClassRunner {
26

  
27
    /**
28
     * @param testClass
29
     * @throws InitializationError
30
     */
31
    public AlternativeUnitilsJUnit4TestClassRunner(Class<?> testClass) throws InitializationError {
32
        super(testClass);
33
    }
34

  
35
    /**
36
     * {@inheritDoc}
37
     */
38
    @Override
39
    public void run(RunNotifier notifier) {
40

  
41
        loadSystemPropertiesFrom("spring-environment.mock.properties");
42
        super.run(notifier);
43
    }
44

  
45
    /**
46
     * @param propFile
47
     */
48
    protected void loadSystemPropertiesFrom(String propFile) {
49
        InputStream inStream = this.getClass().getClassLoader().getResourceAsStream(propFile);
50
        //Properties props = new Properties();
51
        try {
52
            // props.load(inStream);
53
            System.getProperties().load(inStream);
54
        } catch (IOException e) {
55
            throw new RuntimeException(e);
56
        }
57
    }
58

  
59

  
60

  
61
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)