The Kotlin fake data generator library!

Overview

Fakeit

alt text

This library is a port of the Ruby gem Faker. It generates realistic fake data — like names, emails, dates, countries — for a variety of scenarios, including automated testing and database population.

The library was originally created for Android projects, but it can be used in any Java or Kotlin project.

Download

You can use either Maven:

<dependency>
  <groupId>com.github.moove-it</groupId>
  <artifactId>fakeit</artifactId>
  <version>v0.5</version>
</dependency>

or Gradle:

// In your project's build.gradle
allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

//In your module's build.gradle
dependencies {
  compile 'com.github.moove-it:fakeit:v0.5'
}

Basic Usage

Fakeit can be used in Java and Kotlin applications - no Android context needed!

Run the sample app to check all the available models and generate some random values.

First you need to initialize Fakeit:

// Default locale is en for english data.
Fakeit.init()

// You can also pass a Locale or a String locale to change the language.
// See supported languages below.
Fakeit.init(locale)

Then, you need to import the module into each file where it will be used with:

import com.mooveit.library.Fakeit;

Finally, generate fake data like this:

Fakeit.name().lastName()
Fakeit.business().type()
Fakeit.address().city()
Fakeit.card().name()

Supported Data Models

  • Address
  • Ancient
  • App
  • Artist
  • Bank
  • Beer
  • Book
  • Business
  • Card
  • Cat
  • Chuck Norris
  • Code
  • Company
  • Compass
  • Date
  • Demographic
  • Educator
  • Esport
  • File
  • Food
  • Friends
  • Game of Thrones
  • Hacker
  • Harry Potter
  • Hey Arnold
  • Hipster
  • Internet
  • Job
  • Lord of the Rings
  • Lorem
  • Music
  • Name
  • Phone number
  • Pokemon
  • Rick and Morty
  • Rock band

Supported Languages

  • Catalan - Catalunya (ca-CAT)
  • Catalan (ca)
  • Danish - Denmark (da-DK)
  • Deutsch - Österreich (de-AT)
  • Deutsch - Schweiz (de-CH)
  • Deutsch (de)
  • English - Australia (en-AU)
  • English - Australian Slang (en-au-ocker)
  • English - Phonetic Nonsense from The Muppet's Swedish Chef (en-BORK)
  • English - Canada (en-CA)
  • English - Great Britain (en-GB)
  • English - India (en-IND)
  • English - Nepal (en-NEP)
  • English - Nigeria (en-NG)
  • English - New Zealand (en-NZ)
  • English - Pakistan (en-PAK)
  • English - Singapore (en-SG)
  • English - Uganda (en-UG)
  • English - United States (en-US)
  • English - South Africa (en-ZA)
  • English (en)
  • Spanish - Mexico (es-MX)
  • Spanish (es)
  • Farsi (fa)
  • Finnish - Finland (fi-FI)
  • French (fr)
  • Hebrew (he)
  • Indonesian (id)
  • Italian (it)
  • Japenese (ja)
  • Korean (ko)
  • Norwegian - Norway (nb-NO)
  • Netherlands (nl)
  • Polish (pl)
  • Portuguese - Brazil (pt-BR)
  • Portuguese (pt)
  • Russian (ru)
  • Slovak (sk)
  • Swedish (sv)
  • Turkish (tr)
  • Ukranian (uk)
  • Vietnamese (vi)
  • Chinese - China (zh-CN)
  • Chinese - Taiwan (zh-TW)

Unique Values

You can also use Fakeit to generate unique values:

Fakeit.getUniqueValue()

Questions and Issues

For bug reports and feature requests, use Github issue tracker

Contributing

See the contribution guide.

License

MIT

Fakeit is maintained by © Moove-it

Comments
  • Can't initialize Fakeit

    Can't initialize Fakeit

    As soon as I try to initialize Fakeit with any language, for example Fakeit.initWithLocale(Locale.GERMAN), the app crashes.

    The exception I get:

    FATAL EXCEPTION: main Process: xxx.yyy.zzz, PID: 2274 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)  Caused by: java.io.FileNotFoundException: library/src/main/assets/locales/de-DE.yml (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:146) at com.mooveit.library.Fakeit.getValues(Fakeit.kt:81) at com.mooveit.library.Fakeit.(Fakeit.kt:71) at com.mooveit.library.Fakeit.(Fakeit.kt:51) at com.mooveit.library.Fakeit$Companion.fakeitInit(Fakeit.kt:236) at com.mooveit.library.Fakeit$Companion.initWithLocale(Fakeit.kt:256) at xxx.yyy.zzz.HomeFragment.onClick(HomeFragment.kt:63) at android.view.View.performClick(View.java:5624) at android.view.View$PerformClick.run(View.java:22441) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6316) at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) 

    The .yml files seem to be missing but I don't know how to fix this

    opened by JohannesDev 3
  • Remove application tag in library module

    Remove application tag in library module

    <application> tag in AndroidManifest.xml is not necessary for a library module.

    Sometimes it causes compile error even:

    Error:Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : Attribute application@label value=(@string/app_name) from AndroidManifest.xml:8:4-36
    	is also present at [com.github.moove-it:fakeit:v0.2] AndroidManifest.xml:13:9-49 value=(@string/application_name).
    	Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:5:2-20:16 to override.
    
    bug 
    opened by fython 1
  • [Enhancement] If Fakeit is not correctly initialized show friendly exception

    [Enhancement] If Fakeit is not correctly initialized show friendly exception

    Right now if Fakeit is not initialized a NullPointerException is thrown, the best option should be throwing a different exception so the user knows why it's failing.

    enhancement 
    opened by jotaemepereira 0
  • appcompat android dependency

    appcompat android dependency

    * What went wrong:
    Could not resolve all files for configuration ':compileClasspath'.
    > Could not find com.android.support:appcompat-v7:25.0.1.
      Searched in the following locations:
          https://repo1.maven.org/maven2/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.pom
          https://repo1.maven.org/maven2/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.jar
          http://dl.bintray.com/jetbrains/spek/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.pom
          http://dl.bintray.com/jetbrains/spek/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.jar
          https://jcenter.bintray.com/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.pom
          https://jcenter.bintray.com/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.jar
          https://jitpack.io/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.pom
          https://jitpack.io/com/android/support/appcompat-v7/25.0.1/appcompat-v7-25.0.1.jar
      Required by:
          project : > com.github.moove-it:fakeit:v0.5
    

    I am pretty new to Kotlin as a whole and was trying to use this package in a spark app, it seems i need to also have this android dependency? I saw there was another issue that was closed that said it removed all android deps.

    opened by orieken 3
  • Can't use it from unit tests in Android

    Can't use it from unit tests in Android

    When executed from a unit test in Android, Fakeit.init() throws an exception:

    org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed

    at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:200) at org.yaml.snakeyaml.reader.StreamReader.(StreamReader.java:60) at org.yaml.snakeyaml.Yaml.load(Yaml.java:381) at com.mooveit.library.Fakeit.getValues(Fakeit.kt:79) at com.mooveit.library.Fakeit.(Fakeit.kt:69) at com.mooveit.library.Fakeit.(Fakeit.kt:49) at com.mooveit.library.Fakeit$Companion.fakeitInit(Fakeit.kt:233) at com.mooveit.library.Fakeit$Companion.initWithLocale(Fakeit.kt:253) at com.mooveit.library.Fakeit$Companion.initWithLocale(Fakeit.kt:259) at com.mooveit.library.Fakeit$Companion.init(Fakeit.kt:247) at xx.xxxxxx.xxxxx.viewmodels.LibraryViewModel.(LibraryViewModel.kt:104) at xx.xxxxxx.xxxxx.SMMLibraryNavTests.setup(SMMLibraryNavTests.kt:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

    opened by ivanschuetz 8
Releases(v0.7)
  • v0.7(Jul 3, 2017)

  • v0.6(Jul 3, 2017)

  • v0.5(Jun 16, 2017)

  • v0.4(Jun 14, 2017)

    Version 0.4

    • Removed Android dependency! Now you can use Fakeit on your unit tests on Java or Kotlin projects!
    • Added a more friendly message when Fakeit crashes because it was not initialized.
    Source code(tar.gz)
    Source code(zip)
  • v0.3(Jun 13, 2017)

  • v0.2(Mar 31, 2017)

    Version 0.2

    • More models supported: App, Bank, Code, Company, Educator, Hacker, Hey Arnold, Hipster, Internet, Job, Lord of the Rings, Lorem, Music, Phone number, Pokemon, Rick and Morty, Rock Band (#23)
    • Fix crash on getting values from default locale (#23)
    • All models are now live on the sample app. (#23)
    • Improvments on parser function (#26)
    • Add name_with_middle in RU locale (thanks to @seriabov) (#25)
    Source code(tar.gz)
    Source code(zip)
  • v0.1(Mar 21, 2017)

Owner
Moove It
Moove It
An easy to use translation / localization api written in Kotlin that can be used with Java and Kotlin

KTranslate KTranslate is an easy to use TranslationAPI written in Kotlin, with currently 26 supported languages. It is very easy to use in Kotlin and

Felix Beinssen 0 Sep 2, 2022
Library that makes it possible to read, edit and write CSV files

AdaptiveTableLayout Welcome the new CSV Library AdaptiveTableLayout for Android by Cleveroad Pay your attention to our new library that makes it possi

Cleveroad 1.9k Jan 6, 2023
Android Library Finder

alfi Android Library Finder Search through thousands of android libraries that can help you scale your projects elegantly Usage Search for something a

César Ferreira 509 Dec 8, 2022
TaggerString is very light library which allows to build dynamic string resource in much more readable way.

TaggerString TaggerString is very light library which allows to build dynamic string resource in much more readable way. I guess that every Android de

polok 241 Jun 3, 2022
Remote script to create a maven compatible release of an android library (aar)

release-android-library ?? Deprecated ?? This script is deprecated in favour of: novoda/bintray-release Remote script to create a maven compatible rel

Paul Blundell 144 Dec 13, 2022
Simple library to generate and view PDF in Android

PDFCreatorAndroid Simple library to generate and view PDF in Android A simple library to create and view PDF with zero dependency Or native code. Add

Tej Pratap Singh 234 Dec 11, 2022
:inbox_tray: [Android Library] Hunt down all package information

Android library to hunt down package information. The library is built for simplicity and approachability. It not only eliminates most boilerplate cod

Nishant Srivastava 141 Nov 17, 2022
An android library that handles the closing of your app interactively.

Shutdown A library that handles the closing of your app interactively. Overview of Shutdown library Shutdown library handles the closing of your app i

Emmanuel Kehinde 56 Oct 5, 2022
A library which will save you a lot of time from writing the same intent creation code. it consist of many intent creation codes like Share, Contacts, Email and etc, which you can easily use.

Android-Intent-Library A library which will save you a lot of time from writing the same intent creation code. it consist of many intent creation code

Next 67 Aug 24, 2022
Android Material Design Theme UI and Tool Library. Support: 4.0.3~O

GitHub OSChina 中文 English Genius-Android Genius-Android: by Material Design style and some commonly used packages. Starting in 2015, The divided into

Qiujuer 2.3k Dec 27, 2022
Android USB host serial driver library for CDC, FTDI, Arduino and other devices.

usb-serial-for-android This is a driver library for communication with Arduinos and other USB serial hardware on Android, using the Android USB Host M

mike w 3.8k Dec 30, 2022
🍼Debug Bottle is an Android runtime debug / develop tools written using kotlin language.

???? 中文 / ???? 日本語 / ???? English ?? Debug Bottle An Android debug / develop tools written using Kotlin language. All the features in Debug bottle are

Yuriel Arlencloyn 846 Nov 14, 2022
Sweet Android libraries written in Kotlin

Kandy A Kotlin library set dedicated to Android platform which will make programming sweet again! Repository All modules are available on the jcenter.

Kwezal 19 Jul 18, 2021
Analytics Tools for Kotlin Multiplatform Mobile iOS and android

Index Features Example Introduce Architecture Installation Configure Using Screen Mapper Initialization Implementation Delegate Parameters ATEventPara

LINE 16 Dec 5, 2022
A CLI client for Up Bank, written in Kotlin.

upperkt pronounced /ˈʌpəkʌt/ Uppercut your Up balance today! (It's a CLI client for Up - an Australian neobank, written in Kotlin) Installing Right no

Duale Siad 2 Dec 3, 2021
A fake shopping app built using the MVVM archirecture consuming FAKE STORE API

FakeStore A fake shopping app built using the MVVM archirecture consuming FAKE STORE API N/B This API does not provide an endpoint for registering use

marsden madoka 4 Aug 17, 2022
Mirai-device-generator - Mirai Device Generator with kotlin

Mirai Device Generator Mirai DeviceInfo 生成器 作为插件运行时会提供 BotConfigurationAlterer 服

cssxsh 46 Jan 1, 2023
Ecormmerce app built using Android latest UI framework - Compose UI and data coming from Fake Store API

BuyCart ?? Android shopping app built with Jetpack Compose consuming FAKE STORE API I am trying to learn and follow some standard Android architecture

Henry Udorji 4 Aug 5, 2022
Sample Code for fake Kotlin library written in Java

Jatlin このリポジトリは ブログ記事 のためのサンプルコードです。詳細は記事をご覧ください。 プロジェクト構成 :java-lib にKotlinに偽装したJavaファイルが含まれます。 :kotlin-lib は :java-lib をビルドしたJARファイルをKotlinから読み込んで実行

Takaki Hoshikawa 3 Dec 10, 2021
Simple application showing wallets fetched from fake services

LittleWallet Resume Simple application showing wallets fetched from fake services. User can filter wallets by currency types and click to enter a deta

null 0 Nov 15, 2021