Class DefaultCouponCodeClearTextGenerationStrategyUnitTest
- java.lang.Object
-
- de.hybris.platform.couponservices.couponcodegeneration.impl.DefaultCouponCodeClearTextGenerationStrategyUnitTest
-
@UnitTest public class DefaultCouponCodeClearTextGenerationStrategyUnitTest extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DefaultCouponCodeClearTextGenerationStrategyUnitTest()
-
Method Summary
-
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception- Throws:
java.lang.Exception
-
testWrongInputLengths
public void testWrongInputLengths() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testGenerateAndInverseOperationForSpecialCases
public void testGenerateAndInverseOperationForSpecialCases() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
doTestGenerateAndInverseOperation
protected void doTestGenerateAndInverseOperation(long start, long totalRuns, int clearTextLength) throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength2
public void testClearTextGenerationFailsWhenLimitIsReachedLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength4
public void testClearTextGenerationFailsWhenLimitIsReachedLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength6
public void testClearTextGenerationFailsWhenLimitIsReachedLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength8
public void testClearTextGenerationFailsWhenLimitIsReachedLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength2
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength4
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength6
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength8
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
doTestClearTextGeneration
protected void doTestClearTextGeneration(long couponCodeNumber, int length) throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testCodeForLength2
public void testCodeForLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testCodeForLength4
public void testCodeForLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testCodeForLength6
public void testCodeForLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testCodeForLength8
public void testCodeForLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength2
public void testNoClearTextDuplicatesLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength4
public void testNoClearTextDuplicatesLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength6
public void testNoClearTextDuplicatesLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength8
public void testNoClearTextDuplicatesLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
checkForDuplicateClearTextWithLength
protected void checkForDuplicateClearTextWithLength(int length, long seed) throws CouponCodeGenerationExceptionruns through all possible seed values with a default 16-char alphabet (based on clear-text length: length 2 --> 16^2 = 256, 16^4 = 65536 ...) and checks that for each distinct seed value the resulting cleartext doesn't lead to duplicates.- Throws:
CouponCodeGenerationException
-
-