Projects >> simple-petstore >>092a6b6f3814a4df53e0d49490abd56c826bacc3

Chunk
Conflicting content
	}

    
	private Matcher withEmptyText() {
		return withText("");
    }

	@Test
<<<<<<< HEAD
    public void displaysAListOfProductsFound() {
        assertThat(dom(productsPage),
        		hasSelector("#products td",
        				inOrder(hasChild(hasAttribute("src", equalTo("photos/"))),
        						withText("Dalmatian"),
        						withText(""),
        						hasChild(hasAttribute("src", equalTo("photos/labrador"))),
        						withText("Labrador"),
        						withText("Friendly"))));
    }

=======
    public void displaysNameDescriptionAndPhotoOfProductsFoundInDifferentColumns() {
		productsPage = renderProductsPageUsing(aModelWith(
				aProduct().withName("Labrador").describedAs("Friendly").withPhoto("labrador")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td", 
        				inOrder(image("photos/labrador"),
        						productName("Labrador"), 
        						description("Friendly"))));
    }
	
	@Test
	public void displaysNothingInDescriptionColumnForAProductWithNoDescription() {
		productsPage = renderProductsPageUsing(aModelWith(
				aProduct().withName("Labrador").withPhoto("labrador")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td:nth-child(3)", 
        				contains(anEmptyDescription())));		
	}
	
	@Test
	public void displaysDefaultPhotoForAProductWithNoPhoto() {
		productsPage = renderProductsPageUsing(aModelWith(
						aProduct().withName("Labrador").describedAs("Friendly")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td:nth-child(1)", 
        				contains(image("photos/"))));		
	}

	private String renderProductsPageUsing(Map model) {
		return render(PRODUCTS_VIEW).using(model);
	}
	private Matcher anEmptyDescription() {
		return description("");
	}

	private Matcher image(String imageUrl) {
		return hasChild(hasAttribute("src", equalTo(imageUrl)));
	}

	private Matcher description(String description) {
		return withText(description);
	}

	private Matcher productName(String name) {
		return withText(name);
	}
    
>>>>>>> 9e0e34bef28cdea19cce11be3b726370d7e48155
    private Matcher> inOrder(Matcher... elementMatchers) {
        return contains(elementMatchers);
    }
Solution content
    }

	@Test
    public void displaysNameDescriptionAndPhotoOfProductsFoundInDifferentColumns() {
		productsPage = renderProductsPageUsing(aModelWith(
				aProduct().withName("Labrador").describedAs("Friendly").withPhoto("labrador")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td", 
        				inOrder(image("photos/labrador"),
        						productName("Labrador"), 
        						description("Friendly"))));
    }
	
	@Test
	public void displaysNothingInDescriptionColumnForAProductWithNoDescription() {
		productsPage = renderProductsPageUsing(aModelWith(
				aProduct().withName("Labrador").withPhoto("labrador")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td:nth-child(3)", 
        				contains(anEmptyDescription())));		
	}
	
	@Test
	public void displaysDefaultPhotoForAProductWithNoPhoto() {
		productsPage = renderProductsPageUsing(aModelWith(
						aProduct().withName("Labrador").describedAs("Friendly")));
        assertThat(dom(productsPage), 
        		hasSelector("#products td:nth-child(1)", 
        				contains(image("photos/"))));		
	}

	private String renderProductsPageUsing(Map model) {
		return render(PRODUCTS_VIEW).using(model);
	}

	private Matcher withEmptyText() {
		return withText("");
	}
    
	private Matcher anEmptyDescription() {
		return description("");
	}

	private Matcher image(String imageUrl) {
		return hasChild(hasAttribute("src", equalTo(imageUrl)));
	}

	private Matcher description(String description) {
		return withText(description);
	}

	private Matcher productName(String name) {
		return withText(name);
	}
    
    private Matcher> inOrder(Matcher... elementMatchers) {
        return contains(elementMatchers);
    }
File
ProductsViewTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration