Questions tagged [expected-exception]

90 questions
1
vote
0 answers

Reset of ExpectedException does not work as expected

I have a problem with ExpectedException. I'm using it in many tests in one test class. Now i got the problem that our Jenkins has one failing test because this test has the expectedMessage of a previous test. I have no idea why but to prevent this…
Jérôme
  • 1,254
  • 2
  • 20
  • 25
1
vote
2 answers

Replacement for MatchType?

The new NUnit Version 3.x does not support ExpectedExceptionAttribute any longer. There is an Assert.Throws() instead. Probably a better logical concept. But I failed to find any replacement for the old good MatchType - is there any?…
Alex Konnen
  • 717
  • 6
  • 20
1
vote
1 answer

expected primary-expression before ',' token

Im currently getting the error: kernel.c++:76:21: error: expected primary-expression before ',' token Task task1(&gdt , taskA); ^ kernel.c++:77:21: error: expected primary-expression before ',' token Task task2(&gdt ,…
amanuel2
  • 4,508
  • 4
  • 36
  • 67
1
vote
2 answers

Getting a Expected identifier or '(' issue in Xcode 6.1

I'm quite new to C. I've tried other links but no dice. I'm using Xcode 6.1 and I get the following issues: Parse Issue: Expected identifier or '(' Semantic Issue: Unexpected type name 'map' Here's my code: //hashmap.h #ifndef…
Jimmy
  • 189
  • 9
1
vote
1 answer

Parse issue expected expression

I'm stumped by this error. XCTAssertNotNil autocompleted alright and the code seems trivial. "Parse issue" seems so strange, and there are 3 of them. I've tried showing invisibles to find any weird spaces and stuff, but could find nothing. I'm…
Alexandre
  • 2,073
  • 4
  • 21
  • 24
1
vote
1 answer

TestNG expectedExceptions throws TestException

I am trying to test the following class: package com.myclass; public class MyClass { private Map dataMap = new HashMap<>(); public void extractInfoFromLine(String line) throws InvalidInputException { String[] words =…
Karthick S
  • 3,204
  • 6
  • 36
  • 52
1
vote
1 answer

Cannot catch the UnrecognizedPropertyException with ExpectedException using JUnit 4.11

I wrote the following code : @Rule public ExpectedException exception = ExpectedException.none(); @Test public void testMappingException() { exception.expect(ArithmeticException.class); int x = 1 / 0; …
ruhungry
  • 4,506
  • 20
  • 54
  • 98
1
vote
1 answer

'end' expected to close if - lua

I have the following code as part of a LuCI web interface for an application I am making for OpenWRT. I am getting an error which says it is expecting an "end" to close an if statement but I cannot see any statements which have not been closed…
TomSelleck
  • 6,706
  • 22
  • 82
  • 151
1
vote
2 answers

Handling Expected Exceptions

I read several articles regarding good practices in exception handling. Most of it tackled unexpected exceptions yet expected by the author. I just want to clarify and eliminate possible bad practices that I could be doing. Since I already expect…
CudoX
  • 985
  • 2
  • 19
  • 31
0
votes
1 answer

MSTest [TestMethod] fails even when code to test catches and does not rethrow the exception?

I am using MSTest and in a [TestMethod] I have an object whose code throws an exception and I catch it; in certain circumstances, I re-throw it, other times I don't, but the test always fails indicating that the exception was thrown, even though I…
gangelo
  • 3,034
  • 4
  • 29
  • 43
0
votes
2 answers

The declared package "facts" does not match the expected package ""

I am using Eclipse IDE for Enterprise java and web developers. I downloaded some zip file called facts(1) and followed every step in setting up this facts project. When I try to run it on server it showing " ... doesn't match the expected package. …
0
votes
1 answer

ExpectedException with @Rule in junit test on eclipse IDE does not work

I need to make a test in junit that passes if an exception is thrown, but fail time and again. I read a bunch of questions and answers on the topic here in stackoverflow and on other sources. Eventually I came across this page, that explains the…
guyr79
  • 169
  • 1
  • 11
0
votes
1 answer

expected conditions "OR" in Selenium and Java

i am trying to search on item then result if found appear in specific element and if not found another element will appear so i tried to use OR with expected conditions like below: …
M.Zaky
  • 41
  • 1
  • 10
0
votes
1 answer

expected expression before 'return' and '}' (curly brackets). I have tried changing everything, doesn't run

#include int main(){ char a[5]; for(char i = 0, i < 5, ++i){ scanf("%c", &a[i]); } printf("%c", a[5]); return 0; } I changed a[5] into a[i] in the printf, nothing changed. I have compared with this one i found on…
0
votes
0 answers

Spring Boot Testing with Mockito and ExpectedException - console printing 'null' is normal?

I'm writing some test classes for my services and noticed a weird behavior that happens after test results are returned. The console prints 'null' messages and no other information about tests. The tests work fine as I've tried to fail them to…
curiousdev
  • 626
  • 8
  • 24