// Path: locate-api-service/src/main/java/uk/gov/gds/locate/api/dao/AuthorizationTokenDao.java
// public class AuthorizationTokenDao {
// 
//     private final JacksonDBCollection<AuthorizationToken, String> authorizationTokens;
// 
//     public AuthorizationTokenDao(JacksonDBCollection<AuthorizationToken, String> authorizationTokens) {
//         this.authorizationTokens = authorizationTokens;
//     }
// 
//     @Timed
//     public AuthorizationToken fetchCredentialsByBearerToken(String token) {
//         return authorizationTokens.findOne(new BasicDBObject("token", token));
//     }
// 
//     @Timed
//     public Boolean create(AuthorizationToken authorizationToken) {
//         return authorizationTokens.insert(authorizationToken).getN() == 1;
//     }
// 
//     @Timed
//     public void applyIndexes() {
//         authorizationTokens.ensureIndex(new BasicDBObject("token", 1), "token_index", true);
//         authorizationTokens.ensureIndex(new BasicDBObject("identifier", 1), "identifier_index", true);
//     }
// }
// 
// Path: locate-api-service/src/main/java/uk/gov/gds/locate/api/dao/UsageDao.java
// public class UsageDao {
// 
//     private final JacksonDBCollection<Usage, String> collection;
// 
//     public UsageDao(JacksonDBCollection<Usage, String> collection) {
//         this.collection = collection;
//     }
// 
//     @Timed
//     public Optional<Usage> findUsageByIdentifier(String identifier) {
//         return Optional.fromNullable(collection.findAndModify(new BasicDBObject("identifier", identifier), new DBUpdate.Builder().inc("count")));
//     }
// 
//     @Timed
//     public Boolean create(String identifier) {
//         Date expiry = DateTime.now().withZone(DateTimeZone.UTC).withHourOfDay(23).withMinuteOfHour(59).withSecondOfMinute(59).withMillisOfSecond(999).toDate();
//         return collection.insert(new Usage(org.bson.types.ObjectId.get().toString(), identifier, 1, expiry)).getN() == 1;
//     }
// 
//     @Timed
//     public void applyIndexes() {
//         collection.ensureIndex(new BasicDBObject("identifier", 1), "identifier_index", true);
//         collection.ensureIndex(new BasicDBObject("expireAt", 1), new BasicDBObject("expireAfterSeconds", 0));
//     }
// }


import com.google.common.collect.ImmutableMultimap;
import org.junit.Test;
import uk.gov.gds.locate.api.dao.AuthorizationTokenDao;
import uk.gov.gds.locate.api.dao.UsageDao;
import java.io.PrintWriter;
import static org.mockito.Mockito.*;
package uk.gov.gds.locate.api.tasks;




public class MongoIndexTaskTest {

    private AuthorizationTokenDao authorizationTokenDao = mock(AuthorizationTokenDao.class);
// Path: locate-api-service/src/main/java/uk/gov/gds/locate/api/dao/AuthorizationTokenDao.java
// public class AuthorizationTokenDao {
// 
//     private final JacksonDBCollection<AuthorizationToken, String> authorizationTokens;
// 
//     public AuthorizationTokenDao(JacksonDBCollection<AuthorizationToken, String> authorizationTokens) {
//         this.authorizationTokens = authorizationTokens;
//     }
// 
//     @Timed
//     public AuthorizationToken fetchCredentialsByBearerToken(String token) {
//         return authorizationTokens.findOne(new BasicDBObject("token", token));
//     }
// 
//     @Timed
//     public Boolean create(AuthorizationToken authorizationToken) {
//         return authorizationTokens.insert(authorizationToken).getN() == 1;
//     }
// 
//     @Timed
//     public void applyIndexes() {
//         authorizationTokens.ensureIndex(new BasicDBObject("token", 1), "token_index", true);
//         authorizationTokens.ensureIndex(new BasicDBObject("identifier", 1), "identifier_index", true);
//     }
// }
// 
// Path: locate-api-service/src/main/java/uk/gov/gds/locate/api/dao/UsageDao.java
// public class UsageDao {
// 
//     private final JacksonDBCollection<Usage, String> collection;
// 
//     public UsageDao(JacksonDBCollection<Usage, String> collection) {
//         this.collection = collection;
//     }
// 
//     @Timed
//     public Optional<Usage> findUsageByIdentifier(String identifier) {
//         return Optional.fromNullable(collection.findAndModify(new BasicDBObject("identifier", identifier), new DBUpdate.Builder().inc("count")));
//     }
// 
//     @Timed
//     public Boolean create(String identifier) {
//         Date expiry = DateTime.now().withZone(DateTimeZone.UTC).withHourOfDay(23).withMinuteOfHour(59).withSecondOfMinute(59).withMillisOfSecond(999).toDate();
//         return collection.insert(new Usage(org.bson.types.ObjectId.get().toString(), identifier, 1, expiry)).getN() == 1;
//     }
// 
//     @Timed
//     public void applyIndexes() {
//         collection.ensureIndex(new BasicDBObject("identifier", 1), "identifier_index", true);
//         collection.ensureIndex(new BasicDBObject("expireAt", 1), new BasicDBObject("expireAfterSeconds", 0));
//     }
// }


// Path: locate-api-service/src/test/uk/gov/gds/locate/api/tasks/MongoIndexTaskTest.java
import com.google.common.collect.ImmutableMultimap;
import org.junit.Test;
import uk.gov.gds.locate.api.dao.AuthorizationTokenDao;
import uk.gov.gds.locate.api.dao.UsageDao;
import java.io.PrintWriter;
import static org.mockito.Mockito.*;

package uk.gov.gds.locate.api.tasks;




public class MongoIndexTaskTest {

    private AuthorizationTokenDao authorizationTokenDao = mock(AuthorizationTokenDao.class);
    private UsageDao usageDao = mock(UsageDao.class);