Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/test/java/ru/odnoklassniki/homework/TestExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ru.odnoklassniki.homework;

import org.hamcrest.Matchers;
import org.junit.*;
import ru.odnoklassniki.ClassToBeTested;
import java.util.List;
import static org.hamcrest.Matchers.equalTo;


/**
* Created by danny on 15.04.18 at 10:23.
**/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А в целом хотелось бы, всё же, побольше тестов

public class TestExample {
private List<String> list;

@Before
public void init() throws Exception{
list=ClassToBeTested.sortStringsByLength("World!","Hello");
}


@Test(timeout = 10000)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем timeout?

public void testHasItem(){
Assert.assertThat(("list has not value"),list, Matchers.hasItem(equalTo("Hello")));
}

@Test(timeout = 10000)
public void testHasValue(){
Assert.assertThat("String does not match",list.get(1),Matchers.<String>hasToString(equalTo("Hello")));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Брать toString от String'а совсем не обязательно

}
}