├── .gitignore ├── README.md ├── pom.xml └── src ├── main └── java │ └── com │ └── stripe │ └── interview │ └── Main.java └── test └── java └── com └── stripe └── interview └── MainTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | # Maven stuff: 15 | target/ 16 | 17 | # IntelliJ IDEA stuff: 18 | .idea/ 19 | *.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Motivation: 2 | 3 | At Stripe, our interview process has some interviews where you write 4 | code, typically on your laptop. 5 | 6 | We've noticed that more often than not, we've had to spend a significant 7 | portion of the interview helping candidates setup a maven-based Java 8 | environment on their personal laptops. 9 | 10 | We've created a (rather ad-hoc) maven project to help candidates 11 | determine if their laptops were setup to write Java, so interviews can 12 | be about evaluating the candidate, and not the way their environment is 13 | setup. 14 | 15 | # Getting Ready 16 | 17 | If you can run these commands, your development environment is probably 18 | ready for Stripe's Java interview questions: 19 | 20 | ```bash 21 | $ java -version 22 | $ git clone [the project\'s URL] 23 | $ cd [into the project] 24 | $ mvn clean -e install 25 | $ java -jar target/sample-HEAD-SNAPSHOT.jar 26 | ``` 27 | 28 | # About This Project: 29 | 30 | ## Dependencies & Configuration: 31 | 32 | Don't read into the chosen libraries too much. 33 | We've added them to help alleviate two main problems that may be seen 34 | after maven is setup: 35 | - Maven works correctly with third-party dependencies 36 | - Maven's classpath is setup correctly 37 | 38 | ## I prefer Gradle/Pants/Ivy/Makefiles/Bespoke Bash Scripts, do I need to use this? 39 | 40 | If you know prefer different configuration files, that's awesome. 41 | Some interview questions may ask to implement something from nothing, 42 | and some may want to watch you interact with a pre-existing codebase. 43 | For the former, it doesn't matter what you use, as long as you're able 44 | to get things setup quickly. 45 | 46 | Concerning the latter: Maven tends to be the most common format Java 47 | libraries are distributed as. 48 | Because of that, all pre-existing codebases we use in our interviews use 49 | maven. 50 | We aren't really specifically interested in how you write Maven project 51 | files, but want you to quickly get them up and running. 52 | 53 | ## Useful References: 54 | - [Installing Maven](https://maven.apache.org/install.html) 55 | - [using Homebrew, on OS X](https://formulae.brew.sh/formula/maven) 56 | - [more instructions for Windows](https://maven.apache.org/guides/getting-started/windows-prerequisites.html) 57 | - [Apache Maven FAQ](https://maven.apache.org/general.html) 58 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | org.sonatype.oss 7 | oss-parent 8 | 7 9 | 10 | 11 | com.stripe.interview 12 | sample 13 | HEAD-SNAPSHOT 14 | 15 | jar 16 | Stripe Interview Sample 17 | 18 | 19 | A cute maven project to help you double-check your Maven environment is setup correctly. 20 | 21 | 22 | UTF-8 23 | 24 | 1.8 25 | 30.1.1-jre 26 | 4.13.1 27 | 28 | 29 | 30 | 31 | com.google.guava 32 | guava 33 | ${guava.version} 34 | 35 | 36 | 37 | junit 38 | junit 39 | ${junit.version} 40 | test 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.apache.maven.plugins 49 | maven-jar-plugin 50 | 2.4 51 | 52 | 53 | 54 | true 55 | lib/ 56 | com.stripe.interview.Main 57 | 58 | 59 | 60 | 61 | 62 | org.apache.maven.plugins 63 | maven-compiler-plugin 64 | 3.0 65 | true 66 | 67 | ${java.version} 68 | ${java.version} 69 | -Xlint:unchecked 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/java/com/stripe/interview/Main.java: -------------------------------------------------------------------------------- 1 | package com.stripe.interview; 2 | 3 | import com.google.common.html.HtmlEscapers; 4 | 5 | public class Main { 6 | public static void main(String... args) { 7 | System.out.println("Hello world!"); 8 | } 9 | 10 | public static String useGuavaForSomeReason(String input) { 11 | return HtmlEscapers.htmlEscaper().escape(input); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/stripe/interview/MainTest.java: -------------------------------------------------------------------------------- 1 | package com.stripe.interview; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.*; 7 | 8 | public class MainTest { 9 | @Test 10 | public void testUseGuavaForSomeReason() throws Exception { 11 | String actual = Main.useGuavaForSomeReason("hello!"); 12 | Assert.assertEquals("uh oh, the tests failed!", "hello!<a href>", actual); 13 | } 14 | } --------------------------------------------------------------------------------