Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeStackTraceInUnexpectedCheckException()
            public virtual void ShouldIncludeStackTraceInUnexpectedCheckException()
            {
                // GIVEN
                ConsistencySummaryStatistics summary = mock(typeof(ConsistencySummaryStatistics));
                RecordAccess records = mock(typeof(RecordAccess));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<String> loggedError = new java.util.concurrent.atomic.AtomicReference<>();
                AtomicReference <string> loggedError         = new AtomicReference <string>();
                InconsistencyLogger      logger              = new InconsistencyLoggerAnonymousInnerClass(this, loggedError);
                InconsistencyReport      inconsistencyReport = new InconsistencyReport(logger, summary);
                ConsistencyReporter      reporter            = new ConsistencyReporter(records, inconsistencyReport);
                NodeRecord node = new NodeRecord(10);
                RecordCheck <NodeRecord, ConsistencyReport_NodeConsistencyReport> checker = mock(typeof(RecordCheck));
                Exception exception = new Exception("My specific exception");

                doThrow(exception).when(checker).check(any(typeof(NodeRecord)), any(typeof(CheckerEngine)), any(typeof(RecordAccess)));

                // WHEN
                reporter.ForNode(node, checker);

                // THEN
                assertNotNull(loggedError.get());
                string error = loggedError.get();

                assertThat(error, containsString("at "));
                assertThat(error, containsString(TestName.MethodName));
            }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @SuppressWarnings("unchecked") public void shouldLogInconsistency() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShouldLogInconsistency()
            {
                // given
                InconsistencyReport        report   = mock(typeof(InconsistencyReport));
                ConsistencyReport_Reporter reporter = new ConsistencyReporter(mock(typeof(RecordAccess)), report);

                // when
                ReportMethod.invoke(reporter, Parameters(ReportMethod));

                // then
                if (Method.getAnnotation(typeof(ConsistencyReport_Warning)) == null)
                {
                    if (ReportMethod.Name.EndsWith("Change"))
                    {
                        verify(report).error(any(typeof(RecordType)), any(typeof(AbstractBaseRecord)), any(typeof(AbstractBaseRecord)), argThat(HasExpectedFormat()), any(typeof(object[])));
                    }
                    else
                    {
                        verify(report).error(any(typeof(RecordType)), any(typeof(AbstractBaseRecord)), argThat(HasExpectedFormat()), NullSafeAny());
                    }
                }
                else
                {
                    if (ReportMethod.Name.EndsWith("Change"))
                    {
                        verify(report).warning(any(typeof(RecordType)), any(typeof(AbstractBaseRecord)), any(typeof(AbstractBaseRecord)), argThat(HasExpectedFormat()), any(typeof(object[])));
                    }
                    else
                    {
                        verify(report).warning(any(typeof(RecordType)), any(typeof(AbstractBaseRecord)), argThat(HasExpectedFormat()), NullSafeAny());
                    }
                }
            }
Exemplo n.º 3
0
 internal ReportInvocationHandler(InconsistencyReport report, ProxyFactory <REPORT> factory, RecordType type, RecordAccess records, Monitor monitor)
 {
     this.ReportConflict = report;
     this.Factory        = factory;
     this.Type           = type;
     this.Records        = records;
     this.Monitor        = monitor;
 }
Exemplo n.º 4
0
 public ConsistencyReporter(RecordAccess records, InconsistencyReport report, Monitor monitor)
 {
     this._records = records;
     this._report  = report;
     this._monitor = monitor;
 }
Exemplo n.º 5
0
 public ConsistencyReporter(RecordAccess records, InconsistencyReport report) : this(records, report, NoMonitor)
 {
 }
Exemplo n.º 6
0
 public ReportHandler(InconsistencyReport report, ProxyFactory <REPORT> factory, RecordType type, RecordAccess records, AbstractBaseRecord record, Monitor monitor) : base(report, factory, type, records, monitor)
 {
     this.Record = record;
 }
Exemplo n.º 7
0
 internal FormattingDocumentedHandler(InconsistencyReport report, RecordType type)
 {
     this.Report = report;
     this.Type   = type;
 }