Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.codehaus.jackson.JsonNode serialize(ExceptionRepresentation rep) throws org.neo4j.server.rest.domain.JsonParseException
        private JsonNode Serialize(ExceptionRepresentation rep)
        {
            IDictionary <string, object> output     = new Dictionary <string, object>();
            MappingSerializer            serializer = new MappingSerializer(new MapWrappingWriter(output), URI.create(""), mock(typeof(ExtensionInjector)));

            // When
            rep.Serialize(serializer);
            return(JsonHelper.jsonNode(JsonHelper.createJsonFrom(output)));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRenderErrorsWithNeo4jStatusCode() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRenderErrorsWithNeo4jStatusCode()
        {
            // Given
            ExceptionRepresentation rep = new ExceptionRepresentation(new KernelExceptionAnonymousInnerClass(this, UnknownError));

            // When
            JsonNode @out = Serialize(rep);

            // Then
            assertThat(@out.get("errors").get(0).get("code").asText(), equalTo("Neo.DatabaseError.General.UnknownError"));
            assertThat(@out.get("errors").get(0).get("message").asText(), equalTo("Hello"));
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeCause() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldIncludeCause()
        {
            // Given
            ExceptionRepresentation rep = new ExceptionRepresentation(new Exception("Hoho", new Exception("Haha", new Exception("HAHA!"))));

            // When
            JsonNode @out = Serialize(rep);

            // Then
            assertThat(@out.get("cause").get("message").asText(), @is("Haha"));
            assertThat(@out.get("cause").get("cause").get("message").asText(), @is("HAHA!"));
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExcludeLegacyFormatIfAsked() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExcludeLegacyFormatIfAsked()
        {
            // Given
            ExceptionRepresentation rep = new ExceptionRepresentation(new KernelExceptionAnonymousInnerClass2(this, UnknownError)
                                                                      , false);

            // When
            JsonNode @out = Serialize(rep);

            // Then
            assertThat(@out.get("errors").get(0).get("code").asText(), equalTo("Neo.DatabaseError.General.UnknownError"));
            assertThat(@out.get("errors").get(0).get("message").asText(), equalTo("Hello"));
            assertThat(@out.has("message"), equalTo(false));
        }