| 7333 |
dpurdie |
1 |
package com.erggroup.buildtool.utf;
|
|
|
2 |
|
|
|
3 |
import static org.junit.Assert.*;
|
|
|
4 |
|
|
|
5 |
import java.io.File;
|
|
|
6 |
import java.io.IOException;
|
|
|
7 |
|
|
|
8 |
import org.junit.Test;
|
|
|
9 |
|
|
|
10 |
import com.erggroup.buildtool.daemon.BuildInfo;
|
|
|
11 |
|
|
|
12 |
public class TestBuildInfo {
|
|
|
13 |
BuildInfo bi = null;
|
|
|
14 |
Boolean ExceptionSeen = false;
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Test bad file name
|
|
|
18 |
*/
|
|
|
19 |
@Test
|
|
|
20 |
public void badFile()
|
|
|
21 |
{
|
|
|
22 |
File bif = new File ("DoesNotExist");
|
|
|
23 |
try {
|
|
|
24 |
bi = new BuildInfo(bif);
|
|
|
25 |
} catch (IOException e) {
|
|
|
26 |
ExceptionSeen = true;
|
|
|
27 |
}
|
|
|
28 |
assertTrue("Properties file does not exist", ExceptionSeen);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* Test with a good file name
|
|
|
33 |
*/
|
|
|
34 |
@Test
|
|
|
35 |
public void goodFile()
|
|
|
36 |
{
|
|
|
37 |
File bif = new File ("work/buildInfo.properties");
|
|
|
38 |
try {
|
|
|
39 |
bi = new BuildInfo(bif);
|
|
|
40 |
} catch (IOException e) {
|
|
|
41 |
ExceptionSeen = true;
|
|
|
42 |
}
|
|
|
43 |
assertFalse("Properties file does exist", ExceptionSeen);
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* Test basic properties
|
|
|
48 |
*/
|
|
|
49 |
@Test
|
|
|
50 |
public void basicProperties()
|
|
|
51 |
{
|
|
|
52 |
File bif = new File ("work/buildInfo.properties");
|
|
|
53 |
try {
|
|
|
54 |
bi = new BuildInfo(bif);
|
|
|
55 |
} catch (IOException e) {
|
|
|
56 |
ExceptionSeen = true;
|
|
|
57 |
}
|
|
|
58 |
assertFalse("Unexpected Exception", ExceptionSeen);
|
|
|
59 |
|
|
|
60 |
assertEquals("Style", bi.mStyle, "JANTS");
|
|
|
61 |
assertEquals("Java Version", bi.mJavaVersion, "1.8");
|
|
|
62 |
assertFalse("Generic", bi.mGeneric);
|
|
|
63 |
assertTrue ("Platform Count", bi.mPlatforms.size() == 1);
|
|
|
64 |
assertArrayEquals("Platforms", new String[] {"JAVA"}, bi.mPlatforms.toArray());
|
|
|
65 |
assertArrayEquals("Build Platforms", new String[] {"JAVA"}, bi.mBuildPlatforms.toArray());
|
|
|
66 |
assertTrue ("Build Platforms Contains", bi.mPlatforms.contains("JAVA"));
|
|
|
67 |
assertFalse("Build Platforms Not Contains", bi.mPlatforms.contains("java"));
|
|
|
68 |
assertTrue ("Toolsets", bi.mToolsetPlatforms.isEmpty());
|
|
|
69 |
assertTrue ("Lists 1", bi.mDebugPlatforms.contains("DDDD"));
|
|
|
70 |
assertTrue ("Lists 2", bi.mDebugPlatforms.contains("EEEE"));
|
|
|
71 |
assertTrue ("Lists 3", bi.mDebugPlatforms.contains("AAAA"));
|
|
|
72 |
}
|
|
|
73 |
}
|