Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
da1ff79d
Commit
da1ff79d
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-322]
add: - One Unit test method checking case insensitivity. SVN: 5459
parent
a3384563
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
common/sourceTest/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactoryTest.java
+35
-11
35 additions, 11 deletions
...x/cisd/common/parser/AbstractParserObjectFactoryTest.java
with
35 additions
and
11 deletions
common/sourceTest/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactoryTest.java
+
35
−
11
View file @
da1ff79d
...
@@ -32,23 +32,38 @@ import ch.systemsx.cisd.common.annotation.BeanProperty;
...
@@ -32,23 +32,38 @@ import ch.systemsx.cisd.common.annotation.BeanProperty;
public
final
class
AbstractParserObjectFactoryTest
public
final
class
AbstractParserObjectFactoryTest
{
{
private
final
static
IPropertyMapper
createPropertyMapper
()
private
static
final
int
BEAN_NUMBER
=
1
;
private
static
final
String
BEAN_DESCRIPTION
=
"Bean Description"
;
private
static
final
String
BEAN_NAME
=
"Bean Name"
;
private
final
static
IPropertyMapper
createPropertyMapper
(
final
boolean
mixedCase
)
{
{
return
new
DefaultPropertyMapper
(
new
String
[]
final
String
[]
strings
;
{
"name"
,
"description"
,
"number"
});
if
(
mixedCase
)
{
strings
=
new
String
[]
{
"NAME"
,
"Description"
,
"NuMbEr"
};
}
else
{
strings
=
new
String
[]
{
"name"
,
"description"
,
"number"
};
}
return
new
DefaultPropertyMapper
(
strings
);
}
}
private
final
static
String
[]
createDefaultLineTokens
()
private
final
static
String
[]
createDefaultLineTokens
()
{
{
return
new
String
[]
return
new
String
[]
{
"Bean Name"
,
"Bean Description"
,
"1"
};
{
BEAN_NAME
,
BEAN_DESCRIPTION
,
"1"
};
}
}
private
final
void
checkBean
(
final
Bean
bean
)
private
final
void
checkBean
(
final
Bean
bean
)
{
{
assertEquals
(
"Bean Name"
,
bean
.
name
);
assertEquals
(
BEAN_NAME
,
bean
.
name
);
assertEquals
(
"Bean Description"
,
bean
.
description
);
assertEquals
(
BEAN_DESCRIPTION
,
bean
.
description
);
assertEquals
(
1
,
bean
.
number
);
assertEquals
(
BEAN_NUMBER
,
bean
.
number
);
}
}
@Test
(
expectedExceptions
=
AssertionError
.
class
)
@Test
(
expectedExceptions
=
AssertionError
.
class
)
...
@@ -58,7 +73,7 @@ public final class AbstractParserObjectFactoryTest
...
@@ -58,7 +73,7 @@ public final class AbstractParserObjectFactoryTest
}
}
@Test
@Test
public
final
void
testPropertyMapperWith
NoExperiment
Properties
()
public
final
void
testPropertyMapperWith
Unmatched
Properties
()
{
{
final
IPropertyMapper
propertyMapper
=
new
DefaultPropertyMapper
(
new
String
[]
final
IPropertyMapper
propertyMapper
=
new
DefaultPropertyMapper
(
new
String
[]
{
"name"
,
"description"
,
"IsNotIn"
});
{
"name"
,
"description"
,
"IsNotIn"
});
...
@@ -95,7 +110,7 @@ public final class AbstractParserObjectFactoryTest
...
@@ -95,7 +110,7 @@ public final class AbstractParserObjectFactoryTest
@Test
@Test
public
final
void
testTooManyDataColumns
()
public
final
void
testTooManyDataColumns
()
{
{
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
();
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
(
false
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
String
[]
lineTokens
=
(
String
[])
ArrayUtils
.
add
(
createDefaultLineTokens
(),
"notUsed"
);
final
String
[]
lineTokens
=
(
String
[])
ArrayUtils
.
add
(
createDefaultLineTokens
(),
"notUsed"
);
final
Bean
bean
=
beanFactory
.
createObject
(
lineTokens
);
final
Bean
bean
=
beanFactory
.
createObject
(
lineTokens
);
...
@@ -105,7 +120,7 @@ public final class AbstractParserObjectFactoryTest
...
@@ -105,7 +120,7 @@ public final class AbstractParserObjectFactoryTest
@Test
@Test
public
final
void
testNotEnoughDataColumns
()
public
final
void
testNotEnoughDataColumns
()
{
{
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
();
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
(
false
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
String
[]
defaultTokens
=
createDefaultLineTokens
();
final
String
[]
defaultTokens
=
createDefaultLineTokens
();
final
String
[]
lineTokens
=
final
String
[]
lineTokens
=
...
@@ -125,7 +140,7 @@ public final class AbstractParserObjectFactoryTest
...
@@ -125,7 +140,7 @@ public final class AbstractParserObjectFactoryTest
@Test
@Test
public
final
void
testRegisterConverterWithNull
()
public
final
void
testRegisterConverterWithNull
()
{
{
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
();
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
(
false
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
try
try
{
{
...
@@ -138,6 +153,15 @@ public final class AbstractParserObjectFactoryTest
...
@@ -138,6 +153,15 @@ public final class AbstractParserObjectFactoryTest
beanFactory
.
registerConverter
(
String
.
class
,
null
);
beanFactory
.
registerConverter
(
String
.
class
,
null
);
}
}
@Test
public
final
void
testCaseInsensitivity
()
{
final
IPropertyMapper
propertyMapper
=
createPropertyMapper
(
true
);
final
BeanFactory
beanFactory
=
new
BeanFactory
(
Bean
.
class
,
propertyMapper
);
final
Bean
bean
=
beanFactory
.
createObject
(
createDefaultLineTokens
());
checkBean
(
bean
);
}
//
//
// Helper Classes
// Helper Classes
//
//
...
...
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