Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
528c3d8d
Commit
528c3d8d
authored
Oct 19, 2015
by
Romain Bioteau
Browse files
BS-14097
Add non regression test
parent
419832ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.common.repository/src-test/java/org/bonitasoft/studio/common/repository/store/SourceRepositoryStoreTest.java
0 → 100644
View file @
528c3d8d
/**
* Copyright (C) 2015 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.bonitasoft.studio.common.repository.store
;
import
static
org
.
mockito
.
Mockito
.
doCallRealMethod
;
import
static
org
.
mockito
.
Mockito
.
doReturn
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
never
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.util.Collections
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IResource
;
import
org.junit.Test
;
public
class
SourceRepositoryStoreTest
{
@Test
public
void
should_not_use_super_implementation_if_there_is_no_compatible_extensions
()
throws
Exception
{
final
SourceRepositoryStore
sourceRepositoryStore
=
mock
(
SourceRepositoryStore
.
class
);
doReturn
(
Collections
.
emptySet
()).
when
(
sourceRepositoryStore
).
getCompatibleExtensions
();
doCallRealMethod
().
when
(
sourceRepositoryStore
).
getChildren
();
final
IFolder
folder
=
mock
(
IFolder
.
class
);
when
(
folder
.
members
()).
thenReturn
(
new
IResource
[]
{});
doReturn
(
folder
).
when
(
sourceRepositoryStore
).
getResource
();
sourceRepositoryStore
.
getChildren
();
verify
(
sourceRepositoryStore
).
getResource
();
}
@Test
public
void
should_use_super_implementation_if_there_is_compatible_extensions
()
throws
Exception
{
final
SourceRepositoryStore
sourceRepositoryStore
=
mock
(
SourceRepositoryStore
.
class
);
doReturn
(
Collections
.
singleton
(
"groovy"
)).
when
(
sourceRepositoryStore
).
getCompatibleExtensions
();
doCallRealMethod
().
when
(
sourceRepositoryStore
).
getChildren
();
sourceRepositoryStore
.
getChildren
();
verify
(
sourceRepositoryStore
,
never
()).
getResource
();
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment