Example usage for org.apache.commons.lang3 StringUtils repeat

List of usage examples for org.apache.commons.lang3 StringUtils repeat

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils repeat.

Prototype

public static String repeat(final char ch, final int repeat) 

Source Link

Document

<p>Returns padding using the specified delimiter repeated to a given length.</p> <pre> StringUtils.repeat('e', 0) = "" StringUtils.repeat('e', 3) = "eee" StringUtils.repeat('e', -2) = "" </pre> <p>Note: this method doesn't not support padding with <a href="http://www.unicode.org/glossary/#supplementary_character">Unicode Supplementary Characters</a> as they require a pair of char s to be represented.

Usage

From source file:se.sawano.java.security.otp.google.keyuri.AccountNameCreationTests.java

@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] { { value(null), isNotOk() }, { value(""), isNotOk() },
            { value("  "), isNotOk() }, { value("john.doe@example.com"), isOk() }, { value("johnd"), isOk() },
            { value(" johnd "), isOk() }, { value("john:doe"), isNotOk() },
            { value("john#%&/()=?=)(/&%#!"), isOk() },
            { value(StringUtils.repeat("a", Label.AccountName.MAX_LENGTH - 1)), isOk() },
            { value(StringUtils.repeat("a", Label.AccountName.MAX_LENGTH)), isOk() },
            { value(StringUtils.repeat("a", Label.AccountName.MAX_LENGTH + 1)), isNotOk() } });
}

From source file:se.sawano.java.security.otp.google.keyuri.IssuerCreationTests.java

@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] { { value(null), isNotOk() }, { value(""), isNotOk() },
            { value("  "), isNotOk() }, { value("My Company"), isOk() }, { value(" My Company "), isOk() },
            { value("My Company @ 123"), isOk() }, { value("My Company : 123"), isNotOk() },
            { value("My Company @ 123 #%&/()=?=)(/&%#!"), isOk() },
            { value(StringUtils.repeat("a", Label.Issuer.MAX_LENGTH - 1)), isOk() },
            { value(StringUtils.repeat("a", Label.Issuer.MAX_LENGTH)), isOk() },
            { value(StringUtils.repeat("a", Label.Issuer.MAX_LENGTH + 1)), isNotOk() } });
}

From source file:se.sawano.java.security.otp.google.keyuri.parameters.IssuerCreationTests.java

@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] { { value("Example Co"), isOk() }, { value(":"), isOk() },
            { value("My:Company"), isOk() }, { value(""), isNotOk() }, { value("   "), isNotOk() },
            { value(StringUtils.repeat("a", Issuer.MAX_LENGTH - 1)), isOk() },
            { value(StringUtils.repeat("a", Issuer.MAX_LENGTH)), isOk() },
            { value(StringUtils.repeat("a", Issuer.MAX_LENGTH + 1)), isNotOk() } });

}

From source file:se.sawano.java.security.otp.infrastructure.InMemSecretRepositoryTest.java

private SharedSecret secretB() {
    return from(StringUtils.repeat("b", 20), ShaAlgorithm.SHA1);
}

From source file:se.sawano.java.security.otp.infrastructure.InMemSecretRepositoryTest.java

private SharedSecret secretA() {
    return from(StringUtils.repeat("a", 20), ShaAlgorithm.SHA1);
}

From source file:se.sawano.java.security.otp.user.UserIdContractsTest.java

@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] { { id(""), isNotOk() }, { id("  "), isNotOk() },
            { id(null), isNotOk() }, { id(StringUtils.repeat('a', UserId.MAX_LENGTH - 1)), isOk() },
            { id(StringUtils.repeat('a', UserId.MAX_LENGTH)), isOk() },
            { id(StringUtils.repeat('a', UserId.MAX_LENGTH) + "  "), isOk() },
            { id(StringUtils.repeat('a', UserId.MAX_LENGTH + 1)), isNotOk() },
            { id(StringUtils.repeat('a', UserId.MAX_LENGTH + 1_000)), isNotOk() }, });
}