// Path: server/core/src/main/java/org/kercoin/magrit/core/Pair.java
// public class Pair<T, U> {
// 	private T t;
// 	private U u;
// 
// 	public Pair(T t, U u) {
// 		super();
// 		this.t = t;
// 		this.u = u;
// 	}
// 	
// 	public T getT() {
// 		return t;
// 	}
// 
// 	public U getU() {
// 		return u;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((t == null) ? 0 : t.hashCode());
// 		result = prime * result + ((u == null) ? 0 : u.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		@SuppressWarnings("unchecked")
// 		Pair<T, U> other = (Pair<T, U>) obj;
// 		if (t == null) {
// 			if (other.t != null)
// 				return false;
// 		} else if (!t.equals(other.t))
// 			return false;
// 		if (u == null) {
// 			if (other.u != null)
// 				return false;
// 		} else if (!u.equals(other.u))
// 			return false;
// 		return true;
// 	}
// 
// }
// 
// Path: server/core/src/main/java/org/kercoin/magrit/core/utils/SimpleTimeService.java
// public class SimpleTimeService implements TimeService {
// 
// 	@Override
// 	public Pair<Long, Integer> now() {
// 		return now(Calendar.getInstance());
// 	}
// 	
// 	Pair<Long, Integer> now(Calendar when) {
// 		TimeZone tz = when.getTimeZone();
// 		int offsetInMillis = tz.getOffset(when.getTimeInMillis());
// 		int offsetInMinutes = offsetInMillis / (1000 * 60);
// 		return new Pair<Long, Integer>(when.getTimeInMillis(), offsetInMinutes);
// 	}
// 	
// 	
// 	public String offsetToString(int minutes) {
// 		int offsetInHours = Math.abs(minutes) / 60;
// 		int remainderInMinutes = Math.abs(minutes) % 60;
// 		String offsetEncoded = Integer.toString(offsetInHours * 100 + remainderInMinutes);
// 		StringBuilder sb = new StringBuilder();
// 		sb.append(minutes >= 0 ? '+' : '-');
// 		sb.append("0000".substring(offsetEncoded.length()));
// 		sb.append(offsetEncoded);
// 		return sb.toString();
// 	}
// 
// }


import static org.fest.assertions.Assertions.assertThat;
import java.util.Calendar;
import java.util.TimeZone;
import org.junit.Before;
import org.junit.Test;
import org.kercoin.magrit.core.Pair;
import org.kercoin.magrit.core.utils.SimpleTimeService;
/*
Copyright 2011-2012 Frederic Menou and others referred in AUTHORS file.

This file is part of Magrit.

Magrit is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

Magrit 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Magrit.
If not, see <http://www.gnu.org/licenses/>.
*/
package org.kercoin.magrit.core.utils;





public class SimpleTimeServiceTest {

	private static final long SECOND = 1000L;
	private static final long MINUTE = 60 * SECOND;
	private static final long HOUR = 60 * MINUTE;
	private static final long DAY = 24 * HOUR;
	private static final long WEEK = 7 * DAY;
	
// Path: server/core/src/main/java/org/kercoin/magrit/core/Pair.java
// public class Pair<T, U> {
// 	private T t;
// 	private U u;
// 
// 	public Pair(T t, U u) {
// 		super();
// 		this.t = t;
// 		this.u = u;
// 	}
// 	
// 	public T getT() {
// 		return t;
// 	}
// 
// 	public U getU() {
// 		return u;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((t == null) ? 0 : t.hashCode());
// 		result = prime * result + ((u == null) ? 0 : u.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		@SuppressWarnings("unchecked")
// 		Pair<T, U> other = (Pair<T, U>) obj;
// 		if (t == null) {
// 			if (other.t != null)
// 				return false;
// 		} else if (!t.equals(other.t))
// 			return false;
// 		if (u == null) {
// 			if (other.u != null)
// 				return false;
// 		} else if (!u.equals(other.u))
// 			return false;
// 		return true;
// 	}
// 
// }
// 
// Path: server/core/src/main/java/org/kercoin/magrit/core/utils/SimpleTimeService.java
// public class SimpleTimeService implements TimeService {
// 
// 	@Override
// 	public Pair<Long, Integer> now() {
// 		return now(Calendar.getInstance());
// 	}
// 	
// 	Pair<Long, Integer> now(Calendar when) {
// 		TimeZone tz = when.getTimeZone();
// 		int offsetInMillis = tz.getOffset(when.getTimeInMillis());
// 		int offsetInMinutes = offsetInMillis / (1000 * 60);
// 		return new Pair<Long, Integer>(when.getTimeInMillis(), offsetInMinutes);
// 	}
// 	
// 	
// 	public String offsetToString(int minutes) {
// 		int offsetInHours = Math.abs(minutes) / 60;
// 		int remainderInMinutes = Math.abs(minutes) % 60;
// 		String offsetEncoded = Integer.toString(offsetInHours * 100 + remainderInMinutes);
// 		StringBuilder sb = new StringBuilder();
// 		sb.append(minutes >= 0 ? '+' : '-');
// 		sb.append("0000".substring(offsetEncoded.length()));
// 		sb.append(offsetEncoded);
// 		return sb.toString();
// 	}
// 
// }


// Path: server/core/src/test/java/org/kercoin/magrit/core/utils/SimpleTimeServiceTest.java
import static org.fest.assertions.Assertions.assertThat;
import java.util.Calendar;
import java.util.TimeZone;
import org.junit.Before;
import org.junit.Test;
import org.kercoin.magrit.core.Pair;
import org.kercoin.magrit.core.utils.SimpleTimeService;

/*
Copyright 2011-2012 Frederic Menou and others referred in AUTHORS file.

This file is part of Magrit.

Magrit is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

Magrit 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Magrit.
If not, see <http://www.gnu.org/licenses/>.
*/
package org.kercoin.magrit.core.utils;





public class SimpleTimeServiceTest {

	private static final long SECOND = 1000L;
	private static final long MINUTE = 60 * SECOND;
	private static final long HOUR = 60 * MINUTE;
	private static final long DAY = 24 * HOUR;
	private static final long WEEK = 7 * DAY;
	
	SimpleTimeService timeService;