use of net.andreinc.mockneat.MockNeat in project mockneat by nomemory.
the class MockUnitExamplesValStr method main.
public static void main(String[] args) {
MockNeat m = MockNeat.threadLocal();
String alwaysTrue = m.bools().probability(100.0).valStr();
String nullll = m.from(new String[] { null, null, null }).valStr("NULLLL");
System.out.println(nullll);
}
use of net.andreinc.mockneat.MockNeat in project mockneat by nomemory.
the class HrSchema method streeNameGenerator.
/**
* Returns an arbitrary street name.
* @return
*/
private static final MockUnitString streeNameGenerator() {
// A reference to the mock add associated with the current thread;
MockNeat m = MockNeat.threadLocal();
// Returns a random string from the 'STREET_SUFFIX' list;
// Eg: "Str"
MockUnitString streetNameSuffix = m.fromStrings(STREET_SUFFIX);
// Returns a potential street name
// - Streets names have 55% chances of containing two words;
// - Street names have 45% chances of containing one word;
// The single word is always a noun (1 syllable, 2 syllables or 3 syllables)
// The first word if exists is an adjective (1 syllable or 2 syllables)
MockUnitString streetNameGenerator = m.fmt("#{word1}#{word2}").param("word1", m.probabilites(String.class).add(0.55, m.dicts().types(EN_ADJECTIVE_1SYLL, EN_ADJECTIVE_2SYLL)).add(0.45, "").mapToString(s -> s.equals("") ? s : s + " ").format(CAPITALIZED)).param("word2", m.dicts().types(EN_NOUN_1SYLL, EN_NOUN_2SYLL, EN_NOUN_3SYLL).format(CAPITALIZED));
// - Last section is the suffix as obtained above
return m.fmt("#{no} #{name} #{suffix}").param("no", m.ints().range(1, 10000)).param("name", streetNameGenerator).param("suffix", streetNameSuffix);
}
use of net.andreinc.mockneat.MockNeat in project mockneat by nomemory.
the class GenerateURLs method main.
public static void main(String[] args) {
MockNeat m = MockNeat.threadLocal();
m.urls().scheme(HTTP).domain(POPULAR).host(ADVERB_VERB).ports(80, 8080, 8090).list(10).consume(System.out::println);
}
use of net.andreinc.mockneat.MockNeat in project mockneat by nomemory.
the class MockUnitDaysExample01 method main.
public static void main(String[] args) {
MockNeat m = MockNeat.threadLocal();
String day = m.days().after(FRIDAY).display(TextStyle.FULL_STANDALONE, Locale.FRANCE).val();
System.out.println(day);
}
use of net.andreinc.mockneat.MockNeat in project mockneat by nomemory.
the class MockUnitExampleVal method main.
public static void main(String[] args) {
MockNeat m = MockNeat.threadLocal();
String endsWithX = m.strings().val(s -> s + "X");
System.out.println(endsWithX);
}
Aggregations