/** Test method for {@link CriterionParser#CriterionParser(DatabaseSession, String)}. */
 @Test
 public void testCriterionParserDatabaseSessionString() {
   assertEquals(mockSession, testParser.getSession());
   String[] criterionFields = (String[]) getField(testParser, "fields");
   assertArrayEquals(criterionFields, CRITERION_STRING.split(";"));
   MetricDao dao = (MetricDao) getField(testParser, METRIC_DAO_FIELD);
   assertEquals(mockSession, dao.getSession());
 }
 /** To-one relationship, resolved on first access. */
 public Metric getMetric() {
   long __key = this.metric_id;
   if (metric__resolvedKey == null || !metric__resolvedKey.equals(__key)) {
     if (daoSession == null) {
       throw new DaoException("Entity is detached from DAO context");
     }
     MetricDao targetDao = daoSession.getMetricDao();
     Metric metricNew = targetDao.load(__key);
     synchronized (this) {
       metric = metricNew;
       metric__resolvedKey = __key;
     }
   }
   return metric;
 }
 /** Test method for {@link CriterionParser#parse()}. */
 @Test
 public void testParse() {
   setField(testParser, METRIC_DAO_FIELD, mockMetricDao);
   when(mockMetricDao.findMetricByName(METRIC_NAME)).thenReturn(METRIC_1);
   assertSame(METRIC_1, testParser.parse().getMetric());
   assertEquals(AMOUNT, testParser.parse().getAmount(), 0);
   assertEquals(DAYS * 7, testParser.parse().getDays());
 }
 /** Test method for {@link CriterionParser#parseMetric()}. */
 @Test
 public void testParseMetric() {
   setField(testParser, METRIC_DAO_FIELD, mockMetricDao);
   when(mockMetricDao.findMetricByName(METRIC_NAME)).thenReturn(METRIC_1);
   assertSame(METRIC_1, testParser.parseMetric());
 }