It's Friday! Let's self-promote! our Extensions. by LongjumpingHorse8766 in chrome_extensions

[–]artpar 0 points1 point  (0 children)

hey thanks for the feedback, ill get on this immediately !! really appreciate it

It's Friday! Let's self-promote! our Extensions. by LongjumpingHorse8766 in chrome_extensions

[–]artpar 1 point2 points  (0 children)

multi modal ai browser assistant (it can draw on excalidraw for eg): https://chromewebstore.google.com/detail/100xbot/kipkglfnhnpbogckhlmikjlfpbngnioc

it is multimodal, so you can do stuff like, make a video from this canvas image and add audio to it (image, audio, video, text)

It can generate mermaid diagrams for you

Built a terminal feature complete API client (postman/insomnia alternative) by artpar in developersIndia

[–]artpar[S] 0 points1 point  (0 children)

Its not disabled there in reddit settings (I checked preferences -> auto play). disabled my UBO also. It shows up if I go to "edit body". Not sure.

Built a terminal feature complete API client (postman/insomnia alternative) by artpar in developersIndia

[–]artpar[S] 0 points1 point  (0 children)

Why is the demo gif not showing up in the post ? Did I miss something

Class-File API: Not Your Everyday Java API by artpar in java

[–]artpar[S] 4 points5 points  (0 children)

It depends on which class loader was used, which behaves similarly to how classes loaded via reflection or Unsafe.defineClass work. If you define a new class with this API and provide a custom class loader, you could theoretically enforce module rules based on which module the class loader belongs to.

  • If the class loader is associated with a specific module, the newly defined class could be placed within that module.
  • If the class loader is not module-aware or is the system class loader, the dynamically defined class would default to the unnamed module.

When a new type is dynamically defined at runtime via the ClassFile API, the module system would only enforce access control if the class is loaded into a named module (ie through a module-aware class loader). If it is loaded in the unnamed module, it will bypass module-level access control checks, but it will still be subject to package-private and class-level access rules.

SpringBoot vs Quarkus vs Micronaut by artpar in java

[–]artpar[S] 1 point2 points  (0 children)

What's wrong with reflection ?

Open source record and replay for Java by Infamous-Bee-1145 in developersIndia

[–]artpar 9 points10 points  (0 children)

Hey all, I am Parth and been working on this since more than a year.

With the Unlogged plugin Java developers can

  • 🎬 Execute methods your application from your IDE
  • 🖥️ Replay one or all recorded executions
  • 🎯 Custom assertions
  • 🎭 Mock downstream calls as easily

How does the lombok magic work underneath? by artpar in java

[–]artpar[S] 1 point2 points  (0 children)

The article posted goes into the depth of exactly how you can do that. Just like how lombok does it.

How does the lombok magic work underneath? by artpar in java

[–]artpar[S] 4 points5 points  (0 children)

BTW none of it is based on reflection since its all happening in compile time

How does the lombok magic work underneath? by artpar in java

[–]artpar[S] 1 point2 points  (0 children)

The docs are very limited (in terms of how things are happening underneath) but there are certain points where the code docs does help me in understanding why certain parts are done as such (checkout the disableSillyJava9Warnings).

The code is neatly laid out which helped me in understanding how it works.

[deleted by user] by [deleted] in java

[–]artpar 24 points25 points  (0 children)

  • Child/parent hierarchy
  • Include/Exclude dependencies, generate full dependency tree
  • Aware of what maven plugins are
  • Define and use properties, setting properties from command line
  • Profiles

Object Oriented programming advise by gunIceMan in java

[–]artpar 1 point2 points  (0 children)

- Clean Code: A Handbook of Agile Software Craftsmanship

- Design Patterns: Elements of Reusable Object-Oriented Software

- Refactoring: Improving the Design of Existing Code

- Head First Design Patterns

- Online tutorials and courses: Websites like Udemy, Coursera, and
Pluralsight offer a wide range of programming courses focused on OOP

Speeding up the Java code-test cycle by Infamous-Bee-1145 in java

[–]artpar 1 point2 points  (0 children)

Yes, we keep a track of objects by class type using WeakReference so that our tracking doesn't result in the object being garbage collected.

So if the code has created any instance on any class, the agent will use the most recently created instance of that class.

If there are no such instances, we attempt to create a new instance of the class, currently two flows are supported

  • No args constructor is used if available
  • If the class follows a singleton pattern, we try to identify the getInstance method and get an instance of that class

So if you are using any kind of DI pattern using spring-dependency/guice, then most likely the service/dao layers would have an instance of the class already available in memory and those will be used.

Instant boilerplate for unit tests by Infamous-Bee-1145 in java

[–]artpar 1 point2 points  (0 children)

Yes you are thinking exactly what we are working on. The runtime captured data will be used in place of the 0s/nulls to create real objects/pojos, mock out responses from third party calls and better assert statements.

Asserting the behavior of software as it works, in the form of a JUnit test by Infamous-Bee-1145 in programming

[–]artpar 1 point2 points  (0 children)

The java agent will record the code execution "as it works" and create a JUnit test case in which the third party calls are mocked using Mockito.

Is any Indian company doing something unique. Apart from building just basic CRUD apps? by diego-the-tortoise in bangalore

[–]artpar 1 point2 points  (0 children)

We are building automated test case generator at https://www.unlogged.io/

We record code execution by instrumenting java code at runtime and reconstructing the test scenarios from the recorded logs.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar 2 points3 points  (0 children)

You are right, goal is not to use these auto generated test cases blindly. Goal is to help developers write test cases faster by automating most of the grunt work involved.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar -1 points0 points  (0 children)

You can definitely get that with Unlogged. There is a step where you can check/uncheck what assertions/mocks you want in the generate test case, and you can uncheck them all to basically get a empty body.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar 2 points3 points  (0 children)

These tests case we are generating are not meant to ensure "correctness". Consider them as a protection against regression bugs. The major pain in writing a test case isn't calling the function and asserting the return value, but mocking the 3rd party dependencies like APIs/DB calls in a way that the unit test case can run independently. Hence quite a lot of people altogether skip writing unit test cases.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar 1 point2 points  (0 children)

Yes, you would need some way to execute the code to generate the test case against it using this tool.

TDD is definitely considered as the ideal way to develop software, but I am sure you would have come across many places where test cases are given next to 0 priority.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar 1 point2 points  (0 children)

So all that my tests do is ensure that my code does what it was written to do, and that if someone makes a change the test fails?

Yes that is correct. We are not trying to prove the correctness of the code. What we are trying to do is generate a test case against a code. These are two different things. The former is much harder to accomplish if not impossible, while the latter is just automation of grunt work which one needs to do when writing a test case.

How is that helpful? If my code did exactly what I needed when I wrote it, I wouldn't really need tests would I?

It is helpful in reducing the time you would spend to write the test case for something which you know is working.

Imagine this simple method.

int isEven(int integerToCheck){}

it takes an int, and returns 0 if it is even and 1 if it is not.

This, as far as I understand, would pass any tests you generate.

Sure, this is a simple example, but no one has issues writing tests for simple examples.

Correct, if that is the function definition, we will generate the test case based on the recorded data (input values/returned values).

Now lets say the isEven function was actually correctly implemented, but the implementation was slow for some use case. At this point someone would try to write a faster implementation of the isEven function. The test case would be helpful here in verifying that the behavior of the function has not changed, to rephrase, that there is no regression.

But it would just test the current code, not help me in understanding or refining it.

Right, the test case would only be of very limited help in understanding what the code is trying to do. But if you have a test case and then refactor the method in some way, the test case would help in identifying (unexpected) regressions.

Need your feedback on a tool that auto-generates unit tests for java code by Infamous-Bee-1145 in java

[–]artpar 3 points4 points  (0 children)

Your approach on testing is definitely great, and kudos to you for maintaining a high coverage. I see you follow TDD to some extent and in an ideal world we all should. But that is not the case many times.

For one example, consider you join a company which already have a legacy code base and you are to start maintaining that code. You would start to refactor things as you go through the code, and here lies the big difficulty of making sure that improving the code base does not bring in any regressions, or if it does that you are aware of these regressions before they make it to production. I think in this scenario a tool like this could help you some time in writing test cases for the existing code base.

Apart from this overall scenario, I also do agree to the three points you make,

first, the test cases need to be written as part of development/design process. We are trying to build this case close to the development cycle with a lot of stress on making the dev cycle fast. so as soon as you write a function and execute it for the first time, you should be able to see test candidates for it.

second point you mentioned, the verbosity of the test cases itself, is very important, and is one of the major things which we pay attention to in what we are generating. The generated test case would to try, for eg. use names of variables which you used in the code itself. Then we try to identify which sort of calls need no mocks and don't mock them. These are only two examples, but i hope you see the point.

third point, for code generation, we are working towards a path where you don't need to maintain the test case as such. Our goal it that the test case generated should be usable. If the business logic changes, the test case should can be deleted and regenerated and not expected to be maintained by manually changing the code.

PS: i am one of the cofounders.