junit-team / junit4

A programmer-oriented testing framework for Java.
https://junit.org/junit4
Eclipse Public License 1.0
8.53k stars 3.29k forks source link

Refactoring Confirmation for Replace ‘expected’ Attribute with Try-Catch #1777

Closed larjean89 closed 3 months ago

larjean89 commented 3 months ago

Greetings, I have a question regarding a refactoring on this commit from line 79 to 88

@marcphilipp @alb-i986 did you conduct the following refactoring?

Replace ‘expected’ attribute with try-catch This refactoring involves substituting the use of an ‘expected’ attribute for exception handling with a try-catch block for more explicit error management.

Code snippet

-@Test(expected = AssumptionViolatedException.class)
   + @Test
    public void assumeThatWorks() {
        -assumeThat(1, is(2));
       + try {
            +assumeThat(1, is(2));
            +fail("should throw AssumptionViolatedException");
      +  } catch (AssumptionViolatedException e) {
            // expected
        +}
   + }

Thanks and looking forward to hearing from you.

marcphilipp commented 3 months ago

@larjean89 What's your reason for asking?

snicoll commented 3 months ago

FTR, this is likely to be created by a bot. The "OP" created something similar in https://github.com/spring-projects/spring-framework/issues/33329

larjean89 commented 3 months ago

@marcphilipp thank you for your prompt response. I am currently conducting research on various refactoring techniques and their impacts on software development. So, i am in the process of manual checking and confirmation of some refactorings.

larjean89 commented 3 months ago

I am conducting some research on various refactorings. I'm sorry if I posted the question on the wrong platform. Can I be guided on the best route i can take to ask such questions?

Regards


From: Marc Philipp @.> Sent: Tuesday, August 6, 2024 11:54 AM To: junit-team/junit4 @.> Cc: larjean89 @.>; Mention @.> Subject: Re: [junit-team/junit4] Refactoring Confirmation for Replace ‘expected’ Attribute with Try-Catch (Issue #1777)

@larjean89https://github.com/larjean89 What's your reason for asking?

— Reply to this email directly, view it on GitHubhttps://github.com/junit-team/junit4/issues/1777#issuecomment-2270872243, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBYXJ4VHPA5QRD5BRVAZWBTZQCMMTAVCNFSM6AAAAABMBZRTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQHA3TEMRUGM. You are receiving this because you were mentioned.Message ID: @.***>

marcphilipp commented 3 months ago

Yes, the commit authors obviously conducted the refactoring. Was that your full question?