class BasicLoop {

	public String doSomethingWithInput(String input) {
		try {
			String[] articles = input.split(",");
			for (String article : articles) {
				switch (Articles.valueOf(article.trim().toLowerCase())) {
				case pommes:
					total += 100;
					total += remisePommesGlobale();
					break;
				case apples:
					total += 100;
					total += remiseApples();
					total += remisePommesGlobale();
					break;
				case mele:
					total += 100;
					total += remiseMele();
					total += remisePommesGlobale();
					break;
				case cerises:
					total += 75;
					total += remiseCerises();
					break;
				case bananes:
					total += 150;
					total += remiseBananes();
					break;
				}
				total += remiseFruitGlobale();
			}
			return "< " + String.valueOf(total);
		} catch (IllegalArgumentException|NullPointerException e) {
			return "< " + input;
		}
	}

}

class BasicLoopTest {

    @Test
    @Ignore
    public void doit_supporter_la_remise_par_article() {

    	BasicLoop basicLoop = new BasicLoop();
    	String out = basicLoop.doSomethingWithInput("mele");
		assertThat(out ).isEqualTo("< 100");
    	out = basicLoop.doSomethingWithInput("Apples");
		assertThat(out ).isEqualTo("< 200");
    	out = basicLoop.doSomethingWithInput("apples");
		assertThat(out ).isEqualTo("< 300");
		out = basicLoop.doSomethingWithInput("Pommes");
		assertThat(out ).isEqualTo("< 400");
		out = basicLoop.doSomethingWithInput("apples");
		assertThat(out ).isEqualTo("< 400");
		out = basicLoop.doSomethingWithInput("mele");
		assertThat(out ).isEqualTo("< 450");
    	out = basicLoop.doSomethingWithInput("cerises");
		assertThat(out ).isEqualTo("< 525");
    	out = basicLoop.doSomethingWithInput("cerises");
		assertThat(out ).isEqualTo("< 580");
    }

}