Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
ff081f6d
Commit
ff081f6d
authored
10 years ago
by
tmortagne
Browse files
Options
Downloads
Patches
Plain Diff
[misc] Fix test
parent
1cc41268
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/render/DefaultVelocityManagerTest.java
+3
-7
3 additions, 7 deletions
...java/com/xpn/xwiki/render/DefaultVelocityManagerTest.java
with
3 additions
and
7 deletions
xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/render/DefaultVelocityManagerTest.java
+
3
−
7
View file @
ff081f6d
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.Rule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.xwiki.component.util.DefaultParameterizedType
;
import
org.xwiki.context.Execution
;
import
org.xwiki.context.Execution
;
import
org.xwiki.context.ExecutionContext
;
import
org.xwiki.context.ExecutionContext
;
import
org.xwiki.script.ScriptContextManager
;
import
org.xwiki.script.ScriptContextManager
;
...
@@ -79,7 +78,7 @@ public void getVelocityContextUpdatesXContext() throws Exception
...
@@ -79,7 +78,7 @@ public void getVelocityContextUpdatesXContext() throws Exception
executionContext
.
newProperty
(
"velocityContext"
).
initial
(
velocityContext
).
inherited
().
cloneValue
().
declare
();
executionContext
.
newProperty
(
"velocityContext"
).
initial
(
velocityContext
).
inherited
().
cloneValue
().
declare
();
XWikiContext
mockContext
=
mock
(
XWikiContext
.
class
);
XWikiContext
mockContext
=
mock
(
XWikiContext
.
class
);
Provider
<
XWikiContext
>
xcontextProvider
=
this
.
mocker
.
getInstance
(
XWikiContext
.
TYPE_PROVIDER
);
Provider
<
XWikiContext
>
xcontextProvider
=
this
.
mocker
.
registerMockComponent
(
XWikiContext
.
TYPE_PROVIDER
);
when
(
xcontextProvider
.
get
()).
thenReturn
(
mockContext
);
when
(
xcontextProvider
.
get
()).
thenReturn
(
mockContext
);
this
.
mocker
.
getComponentUnderTest
().
getVelocityContext
();
this
.
mocker
.
getComponentUnderTest
().
getVelocityContext
();
...
@@ -95,7 +94,7 @@ public void getVelocityEngineWhenNoVelocityEngineInCache() throws Exception
...
@@ -95,7 +94,7 @@ public void getVelocityEngineWhenNoVelocityEngineInCache() throws Exception
when
(
execution
.
getContext
()).
thenReturn
(
executionContext
);
when
(
execution
.
getContext
()).
thenReturn
(
executionContext
);
XWikiContext
xwikiContext
=
mock
(
XWikiContext
.
class
);
XWikiContext
xwikiContext
=
mock
(
XWikiContext
.
class
);
Provider
<
XWikiContext
>
xcontextProvider
=
this
.
mocker
.
getInstance
(
XWikiContext
.
TYPE_PROVIDER
);
Provider
<
XWikiContext
>
xcontextProvider
=
this
.
mocker
.
registerMockComponent
(
XWikiContext
.
TYPE_PROVIDER
);
when
(
xcontextProvider
.
get
()).
thenReturn
(
xwikiContext
);
when
(
xcontextProvider
.
get
()).
thenReturn
(
xwikiContext
);
com
.
xpn
.
xwiki
.
XWiki
xwiki
=
mock
(
com
.
xpn
.
xwiki
.
XWiki
.
class
);
com
.
xpn
.
xwiki
.
XWiki
xwiki
=
mock
(
com
.
xpn
.
xwiki
.
XWiki
.
class
);
when
(
xwikiContext
.
getWiki
()).
thenReturn
(
xwiki
);
when
(
xwikiContext
.
getWiki
()).
thenReturn
(
xwiki
);
...
@@ -110,10 +109,7 @@ public void getVelocityEngineWhenNoVelocityEngineInCache() throws Exception
...
@@ -110,10 +109,7 @@ public void getVelocityEngineWhenNoVelocityEngineInCache() throws Exception
VelocityEngine
velocityEngine
=
mock
(
VelocityEngine
.
class
);
VelocityEngine
velocityEngine
=
mock
(
VelocityEngine
.
class
);
when
(
velocityFactory
.
createVelocityEngine
(
eq
(
"default"
),
any
(
Properties
.
class
))).
thenReturn
(
velocityEngine
);
when
(
velocityFactory
.
createVelocityEngine
(
eq
(
"default"
),
any
(
Properties
.
class
))).
thenReturn
(
velocityEngine
);
TemplateManager
templates
=
mock
(
TemplateManager
.
class
);
this
.
mocker
.
registerMockComponent
(
TemplateManager
.
class
);
Provider
<
TemplateManager
>
templatesProvider
=
this
.
mocker
.
getInstance
(
new
DefaultParameterizedType
(
null
,
Provider
.
class
,
TemplateManager
.
class
));
when
(
templatesProvider
.
get
()).
thenReturn
(
templates
);
Assert
.
assertSame
(
velocityEngine
,
this
.
mocker
.
getComponentUnderTest
().
getVelocityEngine
());
Assert
.
assertSame
(
velocityEngine
,
this
.
mocker
.
getComponentUnderTest
().
getVelocityEngine
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment