Guest User

Untitled

a guest
Jun 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. [ERROR] COMPILATION ERROR :
  2. [INFO] -------------------------------------------------------------
  3. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[8,20] package org.hamcrest does not exist
  4. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[9,20] package org.hamcrest does not exist
  5. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[61,54] cannot find symbol
  6. symbol: class TypeSafeDiagnosingMatcher
  7. location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil
  8. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[70,54] cannot find symbol
  9. symbol: class Description
  10. location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil.ZonedDateTimeMatcher
  11. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[86,32] cannot find symbol
  12. symbol: class Description
  13. location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil.ZonedDateTimeMatcher
  14. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[69,9] method does not override or implement a method from a supertype
  15. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[85,9] method does not override or implement a method from a supertype
  16. [INFO] 7 errors
  17. [INFO] -------------------------------------------------------------
  18. [INFO] ------------------------------------------------------------------------
  19. [INFO] BUILD FAILURE
  20. [INFO] ------------------------------------------------------------------------
  21. [INFO] Total time: 2.309 s
  22. [INFO] Finished at: 2018-06-24T00:15:51-03:00
  23. [INFO] Final Memory: 31M/285M
  24. [INFO] ------------------------------------------------------------------------
  25. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project ecommercespringboot: Compilation failure: Compilation failure:
  26. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[8,20] package org.hamcrest does not exist
  27. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[9,20] package org.hamcrest does not exist
  28. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[61,54] cannot find symbol
  29. [ERROR] symbol: class TypeSafeDiagnosingMatcher
  30. [ERROR] location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil
  31. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[70,54] cannot find symbol
  32. [ERROR] symbol: class Description
  33. [ERROR] location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil.ZonedDateTimeMatcher
  34. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[86,32] cannot find symbol
  35. [ERROR] symbol: class Description
  36. [ERROR] location: class br.eti.krebscode.ecommercespringboot.utils.TestUtil.ZonedDateTimeMatcher
  37. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[69,9] method does not override or implement a method from a supertype
  38. [ERROR] /home/andre/Documentos/workspace-sts/ecommercespringboot/src/main/java/br/eti/krebscode/ecommercespringboot/utils/TestUtil.java:[85,9] method does not override or implement a method from a supertype
  39. [ERROR] -> [Help 1]
  40. [ERROR]
  41. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  42. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  43. [ERROR]
  44. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  45. [
  46.  
  47. package br.ecommercespringboot.utils;
  48.  
  49. import java.io.IOException;
  50. import java.nio.charset.Charset;
  51. import java.time.ZonedDateTime;
  52. import java.time.format.DateTimeParseException;
  53.  
  54. import org.hamcrest.Description;
  55. import org.hamcrest.TypeSafeDiagnosingMatcher;
  56. import org.springframework.http.MediaType;
  57.  
  58. import com.fasterxml.jackson.annotation.JsonInclude;
  59. import com.fasterxml.jackson.databind.ObjectMapper;
  60. import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
  61.  
  62. public class TestUtil {
  63.  
  64. /** MediaType para JSON UTF8 */
  65. public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(
  66. MediaType.APPLICATION_JSON.getType(),
  67. MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
  68.  
  69. /**
  70. * Converte um objeto para JSON byte array.
  71. *
  72. * @param object
  73. * o objeto para converter
  74. * @return JSON byte array
  75. * @throws IOException
  76. */
  77. public static byte[] convertObjectToJsonBytes(Object object)
  78. throws IOException {
  79. ObjectMapper mapper = new ObjectMapper();
  80. mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
  81.  
  82. JavaTimeModule module = new JavaTimeModule();
  83. mapper.registerModule(module);
  84.  
  85. return mapper.writeValueAsBytes(object);
  86. }
  87.  
  88. /**
  89. * Crie uma matriz de bytes com um tamanho específico preenchido com dados especificos.
  90. *
  91. *
  92. * @param size tamanho do byte array
  93. * @param data dados para colocar no byte array
  94. * @return o JSON byte array
  95. */
  96. public static byte[] createByteArray(int size, String data) {
  97. byte[] byteArray = new byte[size];
  98. for (int i = 0; i < size; i++) {
  99. byteArray[i] = Byte.parseByte(data, 2);
  100. }
  101. return byteArray;
  102. }
  103.  
  104. /**
  105. * Um correspondente que testa que a cadeia examinada representa o mesmo instante que a data e hora de referência.
  106. */
  107. public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher<String> {
  108.  
  109. private final ZonedDateTime date;
  110.  
  111. public ZonedDateTimeMatcher(ZonedDateTime date) {
  112. this.date = date;
  113. }
  114.  
  115. @Override
  116. protected boolean matchesSafely(String item, Description mismatchDescription) {
  117. try {
  118. if (!date.isEqual(ZonedDateTime.parse(item))) {
  119. mismatchDescription.appendText("was ").appendValue(item);
  120. return false;
  121. }
  122. return true;
  123. } catch (DateTimeParseException e) {
  124. mismatchDescription.appendText("was ").appendValue(item)
  125. .appendText(", which could not be parsed as a ZonedDateTime");
  126. return false;
  127. }
  128.  
  129. }
  130.  
  131. @Override
  132. public void describeTo(Description description) {
  133. description.appendText("a String representing the same Instant as ").appendValue(date);
  134. }
  135. }
  136.  
  137. /**
  138. * Cria um correspondente que corresponde quando a cadeia examinada representa a mesma instância que a data e hora de referência
  139. * @param date datetime de referência em relação ao qual a sequência examinada é verificada
  140. */
  141. public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) {
  142. return new ZonedDateTimeMatcher(date);
  143. }
  144.  
  145. }
Add Comment
Please, Sign In to add comment