// Path: src/main/java/io/jvoid/metadata/model/JTest.java
// @Data
// public class JTest implements JEntity<Long> {
// 
//     public static final String RUN_STATUS_RUN = "RUN";
//     public static final String RUN_STATUS_RUNNING = "RUNNING";
//     public static final String RUN_STATUS_SKIPPED = "SKIPPED";
//     public static final String RUN_STATUS_FAILED = "FAILED";
// 
//     private Long id;
//     private Long executionId;
//     private String identifier;
//     private String runStatus = RUN_STATUS_RUNNING;
//     
// }
// 
// Path: src/main/java/io/jvoid/metadata/repositories/TestsRepository.java
// @Singleton
// public class TestsRepository extends AbstractRepository<JTest, Long> {
// 
//     private ResultSetHandler<JTest> objectHandler = new BeanHandler<>(JTest.class);
// 
//     @Inject
//     public TestsRepository(MetadataDatabase database) {
//         super(database);
//     }
// 
//     @Override
//     public JTest findById(Long id) {
//         return query("SELECT * FROM tests WHERE id = ?", objectHandler, id);
//     }
// 
//     @Override
//     public JTest add(JTest jtest) {
//         assertNull(jtest.getId());
//         String sql = "INSERT INTO tests (executionId, identifier, runStatus) VALUES (?, ?, ?)";
//         long id = executeInsert(sql, jtest.getExecutionId(), jtest.getIdentifier(), jtest.getRunStatus());
//         jtest.setId(id);
//         return jtest;
//     }
// 
//     public JTest update(JTest jtest) {
//         String sql = "UPDATE tests SET executionId = ?, identifier = ?, runStatus = ? WHERE id = ?";
//         executeUpdate(sql, jtest.getExecutionId(), jtest.getIdentifier(), jtest.getRunStatus(), jtest.getId());
//         return jtest;
//     }
//     
//     public void linkMethodAndClass(JTest test, long jmethodId, long classId) {
//         List<String> sqlStms = new ArrayList<>();
//         List<Object[]> parametersList = new ArrayList<>();
//         sqlStms.add("INSERT INTO test_methods (testId, methodId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), methodId=VALUES(methodId)");
//         parametersList.add( new Object[]{test.getId(), jmethodId});
//         sqlStms.add("INSERT INTO test_classes (testId, classId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), classId=VALUES(classId)");
//         parametersList.add( new Object[]{test.getId(), classId});
//         
//         executeMultipleInserts(sqlStms, parametersList);
//     }
//     
//     public void linkMethod(JTest test, Long jmethodId) {
//         String sql = "INSERT INTO test_methods (testId, methodId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), methodId=VALUES(methodId)";
//         executeInsert(sql, test.getId(), jmethodId);
//     }
// 
//     public void linkClass(JTest test, Long jclassId) {
//         String sql = "INSERT INTO test_classes (testId, classId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), classId=VALUES(classId)";
//         executeInsert(sql, test.getId(), jclassId);
//     }
// 
//     public JTest findByIdenfifierAndExecutionId(String identifier, long executionId) {
//         return query("SELECT t.* FROM tests t WHERE t.identifier = ? AND t.executionId = ?", objectHandler, identifier, executionId);
//     }
// 
//     public JTest findLatestExecutedByIdenfifier(String identifier) {
//         // @formatter:off
//         String sql = "SELECT t.* " +
//                      "FROM tests t " +
//                      "WHERE t.identifier = ? " +
//                      " AND (t.runStatus = 'FAILED' OR t.runStatus = 'RUN') " +
//                      " AND t.executionId = (" +
//                      "  SELECT MAX(t.executionId) FROM tests t " +
//                      "  WHERE t.identifier = ? " +
//                      "   AND (t.runStatus = 'FAILED' OR t.runStatus = 'RUN') " +
//                      " )";
//         // @formatter:on
//         return query(sql, objectHandler, identifier, identifier);
//     }
// 
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import javax.inject.Inject;
import org.junit.Test;
import io.jvoid.metadata.model.JTest;
import io.jvoid.metadata.repositories.TestsRepository;
package io.jvoid.test.metadata.repositories;





public class TestsRepositoryTest extends AbstractBaseRepositoryTest<JTest, Long, TestsRepository> {

    @Inject
    private TestsRepository testsRepository;

    @Override
    protected JTest prepareForCreation() {
        return createJTest();
    }

    @Override
// Path: src/main/java/io/jvoid/metadata/model/JTest.java
// @Data
// public class JTest implements JEntity<Long> {
// 
//     public static final String RUN_STATUS_RUN = "RUN";
//     public static final String RUN_STATUS_RUNNING = "RUNNING";
//     public static final String RUN_STATUS_SKIPPED = "SKIPPED";
//     public static final String RUN_STATUS_FAILED = "FAILED";
// 
//     private Long id;
//     private Long executionId;
//     private String identifier;
//     private String runStatus = RUN_STATUS_RUNNING;
//     
// }
// 
// Path: src/main/java/io/jvoid/metadata/repositories/TestsRepository.java
// @Singleton
// public class TestsRepository extends AbstractRepository<JTest, Long> {
// 
//     private ResultSetHandler<JTest> objectHandler = new BeanHandler<>(JTest.class);
// 
//     @Inject
//     public TestsRepository(MetadataDatabase database) {
//         super(database);
//     }
// 
//     @Override
//     public JTest findById(Long id) {
//         return query("SELECT * FROM tests WHERE id = ?", objectHandler, id);
//     }
// 
//     @Override
//     public JTest add(JTest jtest) {
//         assertNull(jtest.getId());
//         String sql = "INSERT INTO tests (executionId, identifier, runStatus) VALUES (?, ?, ?)";
//         long id = executeInsert(sql, jtest.getExecutionId(), jtest.getIdentifier(), jtest.getRunStatus());
//         jtest.setId(id);
//         return jtest;
//     }
// 
//     public JTest update(JTest jtest) {
//         String sql = "UPDATE tests SET executionId = ?, identifier = ?, runStatus = ? WHERE id = ?";
//         executeUpdate(sql, jtest.getExecutionId(), jtest.getIdentifier(), jtest.getRunStatus(), jtest.getId());
//         return jtest;
//     }
//     
//     public void linkMethodAndClass(JTest test, long jmethodId, long classId) {
//         List<String> sqlStms = new ArrayList<>();
//         List<Object[]> parametersList = new ArrayList<>();
//         sqlStms.add("INSERT INTO test_methods (testId, methodId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), methodId=VALUES(methodId)");
//         parametersList.add( new Object[]{test.getId(), jmethodId});
//         sqlStms.add("INSERT INTO test_classes (testId, classId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), classId=VALUES(classId)");
//         parametersList.add( new Object[]{test.getId(), classId});
//         
//         executeMultipleInserts(sqlStms, parametersList);
//     }
//     
//     public void linkMethod(JTest test, Long jmethodId) {
//         String sql = "INSERT INTO test_methods (testId, methodId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), methodId=VALUES(methodId)";
//         executeInsert(sql, test.getId(), jmethodId);
//     }
// 
//     public void linkClass(JTest test, Long jclassId) {
//         String sql = "INSERT INTO test_classes (testId, classId) VALUES (?, ?) ON DUPLICATE KEY UPDATE testId=VALUES(testId), classId=VALUES(classId)";
//         executeInsert(sql, test.getId(), jclassId);
//     }
// 
//     public JTest findByIdenfifierAndExecutionId(String identifier, long executionId) {
//         return query("SELECT t.* FROM tests t WHERE t.identifier = ? AND t.executionId = ?", objectHandler, identifier, executionId);
//     }
// 
//     public JTest findLatestExecutedByIdenfifier(String identifier) {
//         // @formatter:off
//         String sql = "SELECT t.* " +
//                      "FROM tests t " +
//                      "WHERE t.identifier = ? " +
//                      " AND (t.runStatus = 'FAILED' OR t.runStatus = 'RUN') " +
//                      " AND t.executionId = (" +
//                      "  SELECT MAX(t.executionId) FROM tests t " +
//                      "  WHERE t.identifier = ? " +
//                      "   AND (t.runStatus = 'FAILED' OR t.runStatus = 'RUN') " +
//                      " )";
//         // @formatter:on
//         return query(sql, objectHandler, identifier, identifier);
//     }
// 
// }


// Path: src/test/java/io/jvoid/test/metadata/repositories/TestsRepositoryTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import javax.inject.Inject;
import org.junit.Test;
import io.jvoid.metadata.model.JTest;
import io.jvoid.metadata.repositories.TestsRepository;

package io.jvoid.test.metadata.repositories;





public class TestsRepositoryTest extends AbstractBaseRepositoryTest<JTest, Long, TestsRepository> {

    @Inject
    private TestsRepository testsRepository;

    @Override
    protected JTest prepareForCreation() {
        return createJTest();
    }

    @Override
    protected TestsRepository getRepo() {