@Test public void testEmptyWhenDoesNotExistAndReturnsZero() { org.junit.Assert.assertNull(sutThatReturnsZeroWhenNotFound.execute("group1")); }
@Override public StreamScope execute(final String inUniqueKey) { if (inUniqueKey != null && !inUniqueKey.isEmpty()) { List<StreamScope> results = getEntityManager().createQuery( "FROM StreamScope WHERE scopeType = :scopeType AND uniqueKey = :uniqueKey").setParameter( "scopeType", scopeType).setMaxResults(1).setParameter("uniqueKey", inUniqueKey.toLowerCase()) .getResultList(); if (results != null && results.size() == 1) { return results.get(0); } } if (throwExceptionOnNotFound) { throw new RuntimeException("Could not find the stream scope with type " + scopeType + " and unique key " + inUniqueKey); } return null; }
GetStreamScopeForScopeTypeByUniqueKey extends BaseArgDomainMapper<String, StreamScope> { @Override public StreamScope execute(final String inUniqueKey) { if (inUniqueKey != null && !inUniqueKey.isEmpty()) { List<StreamScope> results = getEntityManager().createQuery( "FROM StreamScope WHERE scopeType = :scopeType AND uniqueKey = :uniqueKey").setParameter( "scopeType", scopeType).setMaxResults(1).setParameter("uniqueKey", inUniqueKey.toLowerCase()) .getResultList(); if (results != null && results.size() == 1) { return results.get(0); } } if (throwExceptionOnNotFound) { throw new RuntimeException("Could not find the stream scope with type " + scopeType + " and unique key " + inUniqueKey); } return null; } }
GetStreamScopeForScopeTypeByUniqueKey extends BaseArgDomainMapper<String, StreamScope> { @Override public StreamScope execute(final String inUniqueKey) { if (inUniqueKey != null && !inUniqueKey.isEmpty()) { List<StreamScope> results = getEntityManager().createQuery( "FROM StreamScope WHERE scopeType = :scopeType AND uniqueKey = :uniqueKey").setParameter( "scopeType", scopeType).setMaxResults(1).setParameter("uniqueKey", inUniqueKey.toLowerCase()) .getResultList(); if (results != null && results.size() == 1) { return results.get(0); } } if (throwExceptionOnNotFound) { throw new RuntimeException("Could not find the stream scope with type " + scopeType + " and unique key " + inUniqueKey); } return null; } GetStreamScopeForScopeTypeByUniqueKey(final ScopeType inScopeType, //
            final boolean inThrowExceptionOnNotFound); }
GetStreamScopeForScopeTypeByUniqueKey extends BaseArgDomainMapper<String, StreamScope> { @Override public StreamScope execute(final String inUniqueKey) { if (inUniqueKey != null && !inUniqueKey.isEmpty()) { List<StreamScope> results = getEntityManager().createQuery( "FROM StreamScope WHERE scopeType = :scopeType AND uniqueKey = :uniqueKey").setParameter( "scopeType", scopeType).setMaxResults(1).setParameter("uniqueKey", inUniqueKey.toLowerCase()) .getResultList(); if (results != null && results.size() == 1) { return results.get(0); } } if (throwExceptionOnNotFound) { throw new RuntimeException("Could not find the stream scope with type " + scopeType + " and unique key " + inUniqueKey); } return null; } GetStreamScopeForScopeTypeByUniqueKey(final ScopeType inScopeType, //
            final boolean inThrowExceptionOnNotFound); @Override StreamScope execute(final String inUniqueKey); }
GetStreamScopeForScopeTypeByUniqueKey extends BaseArgDomainMapper<String, StreamScope> { @Override public StreamScope execute(final String inUniqueKey) { if (inUniqueKey != null && !inUniqueKey.isEmpty()) { List<StreamScope> results = getEntityManager().createQuery( "FROM StreamScope WHERE scopeType = :scopeType AND uniqueKey = :uniqueKey").setParameter( "scopeType", scopeType).setMaxResults(1).setParameter("uniqueKey", inUniqueKey.toLowerCase()) .getResultList(); if (results != null && results.size() == 1) { return results.get(0); } } if (throwExceptionOnNotFound) { throw new RuntimeException("Could not find the stream scope with type " + scopeType + " and unique key " + inUniqueKey); } return null; } GetStreamScopeForScopeTypeByUniqueKey(final ScopeType inScopeType, //
            final boolean inThrowExceptionOnNotFound); @Override StreamScope execute(final String inUniqueKey);  }