Skip to content

Commit

Permalink
Merge branch 'TS09-OtimizacaoLayout' into developer
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsclimaco committed May 15, 2017
2 parents 7547000 + fee8de0 commit 2486841
Show file tree
Hide file tree
Showing 32 changed files with 606 additions and 755 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.support.design.widget.FloatingActionButton;
import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
Expand Down Expand Up @@ -65,13 +66,13 @@ public void shouldClickOnClassCreated(){
.getSupportFragmentManager()
.findFragmentById(frame);

ListView listView =
(ListView) classFragment.getActivity()
.findViewById(R.id.class_list_view);
RecyclerView recyclerView =
(RecyclerView) classFragment.getActivity()
.findViewById(R.id.recycler);

if(listView.getAdapter().getCount() > 0) {
if(recyclerView.getAdapter().getItemCount() > 0) {

onView(ViewMatchers.withId(R.id.class_list_view))
onView(ViewMatchers.withId(R.id.recycler))
.perform(click());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
public class CreateClassActivityIntrumentedTest {

@Rule
public ActivityTestRule<CreateClassActivity> rule =
public ActivityTestRule<CreateClassActivity> rule =
new ActivityTestRule<>(CreateClassActivity.class);



@Before
public void setUp() {
UserAccountControl.getInstance(rule.getActivity()).authenticateLogin("[email protected]", "123456");
Expand Down Expand Up @@ -104,32 +102,6 @@ public void shouldValidateNullPassword() throws UserException{
.check(matches(hasErrorText("Preencha todos os campos!")));
}

@Test
public void shouldValidateNullCutOff() throws UserException{
onView(withId(R.id.edit_text_class_name))
.perform(typeText("Calculo 1"));
closeSoftKeyboard();
onView(withId(R.id.edit_text_institution))
.perform(typeText("UnB"));
closeSoftKeyboard();
onView(withId(R.id.edit_text_class_password))
.perform(typeText("Senha1"));
closeSoftKeyboard();
onView(withId(R.id.edit_text_cut_grade))
.perform(typeText(""));
closeSoftKeyboard();
onView(withId(R.id.edit_text_size_groups))
.perform(typeText(String.valueOf(5)));
closeSoftKeyboard();
onView(withId(R.id.edit_text_addition))
.perform(typeText(String.valueOf(0.5)));
closeSoftKeyboard();
onView(withId(R.id.button_save))
.perform(click());
onView(withId(R.id.edit_text_class_name))
.check(matches(hasErrorText("Preencha todos os campos!")));
}

@Test
public void shouldValidateNullSizeGroup() throws UserException{
onView(withId(R.id.edit_text_class_name))
Expand Down Expand Up @@ -205,7 +177,7 @@ public void shouldValidateClassNameMinLength() throws UserException{
onView(withId(R.id.button_save))
.perform(click());
onView(withId(R.id.edit_text_class_name)).check(matches
(hasErrorText("@string/msg_class_name_case_error_message")));
(hasErrorText("O nome da sala deve ter de 3 a 20 caracteres.")));
}

@Test
Expand Down Expand Up @@ -257,7 +229,7 @@ public void shouldValidateInstitutionMinLength() throws UserException{
onView(withId(R.id.button_save))
.perform(click());
onView(withId(R.id.edit_text_institution)).check(matches(
hasErrorText("@string/msg_institution_case_error_message")));
hasErrorText("O nome da instituicao deve ter de 3 a 20 caracteres.")));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setUp() throws Exception {
public void shouldAssertNotNullActivity(){
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(withId(floating_btn))
.perform(click());
Expand All @@ -73,7 +73,7 @@ public void shouldAssertNotNullActivity(){
public void shouldValidateNullExamName() throws UserException {
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(withId(floating_btn))
.perform(click());
Expand All @@ -93,7 +93,7 @@ public void shouldValidateNullExamName() throws UserException {
public void shouldValidadeExamNameMinLength() throws UserException{
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(withId(floating_btn))
.perform(click());
Expand All @@ -113,7 +113,7 @@ public void shouldValidadeExamNameMinLength() throws UserException{
public void shouldValidadeExamNameMaxLength() throws UserException{
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(withId(floating_btn))
.perform(click());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void setUp() {
public void shouldValidateExamsFragmentInitialization(){
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(ViewMatchers.withText("EXAMS"))
.perform(click());
Expand All @@ -61,7 +61,7 @@ public void shouldValidateExamsFragmentInitialization(){
// public void shouldClickOnExamRegistered(){
// onView(withId(R.id.salas_item))
// .perform(click());
// onData(anything()).inAdapterView(withId(R.id.class_list_view))
// onData(anything()).inAdapterView(withId(R.id.recycler))
// .atPosition(0).perform(click());
//
// ListView listView;
Expand Down Expand Up @@ -93,7 +93,7 @@ public void shouldValidateExamsFragmentInitialization(){
public void shouldClickOnExamButton(){
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(ViewMatchers.withText("EXAMS"))
.perform(click());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ public void shouldCallClassFragment(){
onView(withId(R.id.salas_item))
.perform(click());

assertThat(rule.getActivity().
getSupportFragmentManager().findFragmentById(frame).getTag(),
is(equalTo("fragment_class")));

}

@Test
Expand All @@ -53,34 +49,6 @@ public void shouldCallUserFragment(){
onView(withId(R.id.usuario_item))
.perform(click());

assertThat(rule.getActivity()
.getSupportFragmentManager().findFragmentById(frame)
.getTag(), is(equalTo("fragment_user")));

}

@Test
public void shouldCallAboutFragment(){

onView(withId(R.id.about_item))
.perform(click());

assertThat(rule.getActivity()
.getSupportFragmentManager().findFragmentById(frame)
.getTag(), is(equalTo("fragment_about")));

}

@Test
public void shouldCallEvaluationFragment(){

onView(withId(R.id.avaliacao_item))
.perform(click());

assertThat(rule.getActivity().
getSupportFragmentManager().findFragmentById(frame)
.getTag(), is(equalTo("fragment_evaluation")));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void setUp() {
public void shouldValidateStudentsFragmentInitialization(){
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(ViewMatchers.withText("STUDENTS"))
.perform(click());
Expand All @@ -60,7 +60,7 @@ public void shouldValidateStudentsFragmentInitialization(){
// public void shouldClickOnStudentRegistered(){
// onView(withId(R.id.salas_item))
// .perform(click());
// onData(anything()).inAdapterView(withId(R.id.class_list_view))
// onData(anything()).inAdapterView(withId(R.id.recycler))
// .atPosition(0).perform(click());
//
// ListView listView;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void shouldValidateStudentsFragmentInitialization(){
public void shouldClickOnButtonStudent(){
onView(withId(R.id.salas_item))
.perform(click());
onData(anything()).inAdapterView(withId(R.id.class_list_view))
onData(anything()).inAdapterView(withId(R.id.recycler))
.atPosition(0).perform(click());
onView(ViewMatchers.withText("STUDENTS"))
.perform(click());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.ExecutionException;

import fga.mds.gpp.trezentos.DAO.getAllClassRequest;
import fga.mds.gpp.trezentos.DAO.AddStudentToClassRequest;
import fga.mds.gpp.trezentos.DAO.getClassRequest;
import fga.mds.gpp.trezentos.DAO.CreateClassPost;
import fga.mds.gpp.trezentos.Exception.UserClassException;
import fga.mds.gpp.trezentos.Exception.UserException;
Expand Down Expand Up @@ -54,7 +50,6 @@ public void validateCreateClass(String className, String institution,
}
}


public String validateInformation(String className, String institution,
String cutOff, String password,
String addition, String sizeGroups) throws UserException {
Expand All @@ -74,22 +69,10 @@ public String validateInformation(String className, String institution,
}
}


public ArrayList<UserClass> getClasses() {

getAllClassRequest classRequest = new getAllClassRequest();

String serverResponse = "404";

try {
serverResponse = classRequest.execute().get();

} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}

serverResponse = classRequest.get();
ArrayList<UserClass> userClasses = new ArrayList<UserClass>();

try {
Expand All @@ -99,10 +82,9 @@ public ArrayList<UserClass> getClasses() {
}

return userClasses;

}

private ArrayList<UserClass> getArrayList(String serverResponse) throws JSONException {
private ArrayList<UserClass> getArrayList(String serverResponse) throws JSONException{

JSONArray array = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import fga.mds.gpp.trezentos.DAO.CreateExamPost;
import fga.mds.gpp.trezentos.DAO.getClassRequest;
import fga.mds.gpp.trezentos.DAO.getExamRequest;
import fga.mds.gpp.trezentos.Exception.UserException;
import fga.mds.gpp.trezentos.Model.Exam;
Expand Down Expand Up @@ -65,15 +64,7 @@ public ArrayList<Exam> getExamsFromUser(String email, String userClassName) {
getExamRequest examRequest = new getExamRequest(email, userClassName);

String serverResponse = "404";

try {
serverResponse = examRequest.execute().get();
}catch (InterruptedException e){
e.printStackTrace();
}catch (ExecutionException e){
e.printStackTrace();
}

serverResponse = examRequest.get();
ArrayList<Exam> userExams = new ArrayList<Exam>();

try{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@
import okhttp3.Request;
import okhttp3.Response;

public class getAllClassRequest extends AsyncTask<String, String, String> {
public class getAllClassRequest {


private final String url =
"https://trezentos-api.herokuapp.com/api/class/find";
private final String url = "https://trezentos-api.herokuapp.com/api/class/find";

public getAllClassRequest(){
public getAllClassRequest(){}

}

@Override
protected String doInBackground(String... params) {
public String get(){

OkHttpClient client = new OkHttpClient();

Expand All @@ -39,8 +36,10 @@ protected String doInBackground(String... params) {
}

return null;

}


private String getUrlWithParameters() {

HttpUrl.Builder builder = HttpUrl.parse(url).newBuilder();
Expand Down
48 changes: 0 additions & 48 deletions app/src/main/java/fga/mds/gpp/trezentos/DAO/getClassRequest.java

This file was deleted.

Loading

0 comments on commit 2486841

Please sign in to comment.