Rename test to match refactoring of candlestick code
This commit is contained in:
@ -1,20 +1,18 @@
|
||||
package ats.plugin;
|
||||
|
||||
import ats.plugin.OHLCPlugInView;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
import org.joda.time.Instant;
|
||||
import org.joda.time.Period;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static org.junit.Assert.*;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
||||
public class OHLCPlugInViewTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(OHLCPlugInViewTest.class);
|
||||
public class TimeCandlestickWindowTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(TimeCandlestickWindowTest.class);
|
||||
private static DateTimeFormatter dateFormatter = ISODateTimeFormat.dateTime();
|
||||
|
||||
|
||||
@ -40,7 +38,7 @@ public class OHLCPlugInViewTest {
|
||||
Duration interval,
|
||||
String expected)
|
||||
{
|
||||
DateTime l = OHLCPlugInView.makeWindowStartTime(currentTime, interval);
|
||||
DateTime l = TimeCandlestickWindow.makeWindowStartTime(currentTime, interval);
|
||||
String start = dateFormatter.print(l);
|
||||
|
||||
expected += ".000Z";
|
||||
@ -50,7 +48,6 @@ public class OHLCPlugInViewTest {
|
||||
// log.info("start time: {}", start);
|
||||
// log.info(" expected: {}", expected);
|
||||
|
||||
//assertEquals(interval.toString(), l.longValue(), Instant.parse("2018-05-15T13:23:00").getMillis());
|
||||
assertEquals(interval.toString(), expected, start);
|
||||
}
|
||||
|
||||
@ -63,41 +60,6 @@ public class OHLCPlugInViewTest {
|
||||
}
|
||||
|
||||
private void assertParseInterval(String str, Duration expected) {
|
||||
assertEquals(OHLCPlugInView.parseInterval(str), expected);
|
||||
assertEquals(TimeCandlestickWindow.parseInterval(str), expected);
|
||||
}
|
||||
|
||||
/*
|
||||
private static Long makeWindowStartTime(Long timestamp, Duration interval) {
|
||||
long today = getDayStart(timestamp);
|
||||
long intoToday = timestamp - today;
|
||||
|
||||
// then modulo timestamp to find how far into the current window we'd be in
|
||||
long intoPeriod = intoToday % interval.getMillis();
|
||||
|
||||
// then subtract modulo from current time to get window start
|
||||
return timestamp - intoPeriod;
|
||||
}
|
||||
|
||||
private static long getDayStart(Long timestamp) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(timestamp);
|
||||
cal.set(Calendar.HOUR, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
|
||||
private static Long makeWindowEndTime(Long startTime, Duration interval) {
|
||||
if (startTime == null || interval == null) return null;
|
||||
|
||||
return startTime + interval.getMillis();
|
||||
}
|
||||
|
||||
private boolean inWindow(Long timestamp) {
|
||||
if (timestamp == null) return false;
|
||||
|
||||
return timestamp >= windowStartTime && timestamp < windowEndTime;
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user