-
Notifications
You must be signed in to change notification settings - Fork 309
/
LibraryJarInBootstrapTest.scala
63 lines (53 loc) · 2.19 KB
/
LibraryJarInBootstrapTest.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package org.scalaide.debug.internal.launching
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import scala.io.Codec
import scala.io.Source
import org.eclipse.core.resources.IResource
import org.eclipse.core.resources.IncrementalProjectBuilder
import org.eclipse.core.runtime.NullProgressMonitor
import org.eclipse.debug.core.DebugPlugin
import org.eclipse.debug.core.ILaunch
import org.eclipse.debug.core.ILaunchManager
import org.eclipse.debug.core.ILaunchesListener2
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.scalaide.core.testsetup.SdtTestConstants
import org.scalaide.core.testsetup.TestProjectSetup
import LibraryJarInBootstrapTest.file
import LibraryJarInBootstrapTest.project
object LibraryJarInBootstrapTest extends TestProjectSetup("launching-1000919", bundleName = "org.scala-ide.sdt.debug.tests")
class LibraryJarInBootstrapTest extends LaunchUtils {
import LibraryJarInBootstrapTest._
override val launchConfigurationName = "t1000919.ScalaTest"
@Before
def initializeTests(): Unit = {
cleanBuild(project.underlying)
}
/**
* Ticket 1000919.
* Before the fix, if order of the Scala library container and the JRE container was 'wrong', the Scala library was not added
* to the boot classpath for test execution (nor the classpath) and the launch would fail.
*/
@Ignore(SdtTestConstants.TestRequiresGuiSupport)
@Test
def checkTestIsCorrectlyExecutedWhenLibraryJarAfterJRE(): Unit = {
whenApplicationWasLaunchedFor(project.underlying, inMode = ILaunchManager.RUN_MODE) {
// check the result
// refresh the project to be able to see the new file
project.underlying.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor)
val resultFile = file("t1000919.result")
assertTrue("No result file, the launched test likely failed to run", resultFile.exists)
// check the content
val source = Source.fromInputStream(resultFile.getContents)(Codec.UTF8)
try {
assertEquals("Wrong result file content", "t1000919 success", source.mkString)
} finally {
source.close
}
}
}
}