Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphael
histream
Commits
3f6f05f2
Commit
3f6f05f2
authored
Aug 25, 2015
by
rwm
Browse files
fixed illegal output of DateTimeAccuracy
parent
dad1fe5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
histream-core/src/main/java/de/sekmi/histream/DateTimeAccuracy.java
View file @
3f6f05f2
...
...
@@ -150,8 +150,11 @@ public class DateTimeAccuracy implements Temporal, Comparable<DateTimeAccuracy>
*/
private
void
appendWithZeroPrefix
(
StringBuilder
builder
,
TemporalField
field
,
int
digits
){
int
v
=
dateTime
.
get
(
field
);
for
(
int
i
=
digits
;
i
>
1
&&
v
<(
10
^(
i
-
1
));
i
--){
int
pow
=
1
;
for
(
int
i
=
1
;
i
<
digits
;
i
++
)
pow
*=
10
;
while
(
v
<
pow
&&
pow
>
1
){
builder
.
append
(
'0'
);
pow
/=
10
;
}
builder
.
append
(
v
);
}
...
...
histream-core/src/test/java/de/sekmi/histream/impl/TestDateTimeAccuracy.java
View file @
3f6f05f2
...
...
@@ -41,11 +41,14 @@ public class TestDateTimeAccuracy {
}
@Test
public
void
testParseToString
(){
final
String
str
=
"2001-03-04T05:06:07"
;
DateTimeAccuracy
a
=
DateTimeAccuracy
.
parsePartialIso8601
(
str
);
final
String
[]
str
=
new
String
[]{
"2001-03-04T10:16:07"
,
"2001-03-04T10:16:00"
}
;
DateTimeAccuracy
a
=
DateTimeAccuracy
.
parsePartialIso8601
(
str
[
0
]
);
Assert
.
assertEquals
(
ChronoUnit
.
SECONDS
,
a
.
getAccuracy
());
assertFieldValues
(
a
,
new
int
[]{
2001
,
3
,
4
,
5
,
6
,
7
});
Assert
.
assertEquals
(
str
,
a
.
toPartialIso8601
());
assertFieldValues
(
a
,
new
int
[]{
2001
,
3
,
4
,
10
,
16
,
7
});
for
(
String
s
:
str
){
a
=
DateTimeAccuracy
.
parsePartialIso8601
(
s
);
Assert
.
assertEquals
(
s
,
a
.
toPartialIso8601
());
}
}
@Test
...
...
histream-core/src/test/java/de/sekmi/histream/impl/XPathEvaluatorTest.java
View file @
3f6f05f2
...
...
@@ -33,7 +33,7 @@ public class XPathEvaluatorTest {
Observation
o
=
s
.
get
();
//System.out.println("XXX:"+eval.evaluateToString("translate(fact/@start,'-:T','')", o));
//System.out.println(XPathEvaluator.toXMLString(o));
String
[]
trueExpressions
=
new
String
[]{
"f:fact/@patient"
,
"f:fact/@concept"
,
"f:fact/@start"
,
"number(translate(f:fact/@start,'-:T',''))=20140907
0
104003"
};
String
[]
trueExpressions
=
new
String
[]{
"f:fact/@patient"
,
"f:fact/@concept"
,
"f:fact/@start"
,
"number(translate(f:fact/@start,'-:T',''))=20140907104003"
};
for
(
String
expr
:
trueExpressions
){
Assert
.
assertEquals
(
expr
,
true
,
eval
.
test
(
expr
,
o
));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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